本文整理汇总了Java中android.widget.CheckedTextView.setText方法的典型用法代码示例。如果您正苦于以下问题:Java CheckedTextView.setText方法的具体用法?Java CheckedTextView.setText怎么用?Java CheckedTextView.setText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.CheckedTextView
的用法示例。
在下文中一共展示了CheckedTextView.setText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initNetTags
import android.widget.CheckedTextView; //导入方法依赖的package包/类
private void initNetTags(List<String> allNames) {
TagFlowLayout flowLayoutRecommend = mBinding.flowLayoutRecommend;
TagAdapter adapter = new TagAdapter<String>(allNames) {
@Override
public View getView(FlowLayout parent, int position, String s) {
View view = inflater.inflate(R.layout.item_search_tag, null);
CheckedTextView tag = (CheckedTextView) view.findViewById(R.id.tv_tag);
if (position == 2) tag.setChecked(true);
tag.setText(s);
return tag;
}
};
flowLayoutRecommend.setAdapter(adapter);
flowLayoutRecommend.setOnTagClickListener((view, position, parent) -> {
String item = (String) adapter.getItem(position);
return false;
});
}
示例2: getView
import android.widget.CheckedTextView; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = inflater.inflate(android.R.layout.simple_list_item_multiple_choice,
parent, false);
}
TodoItem item = getItem(position);
CheckedTextView textView = (CheckedTextView) convertView;
textView.setChecked(item.complete());
CharSequence description = item.description();
if (item.complete()) {
SpannableString spannable = new SpannableString(description);
spannable.setSpan(new StrikethroughSpan(), 0, description.length(), 0);
description = spannable;
}
textView.setText(description);
return convertView;
}
示例3: getView
import android.widget.CheckedTextView; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
TGToolbarTrackListItem item = (TGToolbarTrackListItem) this.getItem(position);
View view = (convertView != null ? convertView : getLayoutInflater().inflate(R.layout.view_main_drawer_check_item, parent, false));
CheckedTextView checkedTextView = (CheckedTextView) view.findViewById(R.id.main_drawer_check_item);
checkedTextView.setText(item.getLabel());
checkedTextView.setChecked(Boolean.TRUE.equals(item.getSelected()));
checkedTextView.setOnClickListener(this.createGoToTrackAction(item.getTrack()));
CheckBox checkBox = (CheckBox) view.findViewById(R.id.checkbox_mute_track);
checkBox.setChecked(Boolean.TRUE.equals(item.getTrack().isMute()));
checkBox.setOnClickListener(this.createMuteTrackAction(item.getTrack()));
return view;
}
示例4: getView
import android.widget.CheckedTextView; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null)
convertView = LayoutInflater.from(getContext()).inflate(resource, null);
ContactItem contact = getItem(position);
if (contact != null) {
String html = "<b>" + contact.name + "</b> " + contact.number;
Spanned newText;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
newText = Html.fromHtml(html, Html.FROM_HTML_MODE_LEGACY);
else
newText = Html.fromHtml(html);
CheckedTextView textView = (CheckedTextView) convertView;
textView.setText(newText);
textView.setChecked(contact.checked);
textView.jumpDrawablesToCurrentState(); // (!!!) Ferma l'animazione dovuta a setChecked, terribile quando vengono riciclate le view
}
return convertView;
}
示例5: getView
import android.widget.CheckedTextView; //导入方法依赖的package包/类
@Override public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = inflater.inflate(android.R.layout.simple_list_item_multiple_choice, parent, false);
}
TodoItem item = getItem(position);
CheckedTextView textView = (CheckedTextView) convertView;
textView.setChecked(item.complete());
CharSequence description = item.description();
if (item.complete()) {
SpannableString spannable = new SpannableString(description);
spannable.setSpan(new StrikethroughSpan(), 0, description.length(), 0);
description = spannable;
}
textView.setText(description);
return convertView;
}
示例6: getChildView
import android.widget.CheckedTextView; //导入方法依赖的package包/类
/**
* @param groupPosition int
* @param childPosition int
* @param isLastChild boolean
* @param convertView View
* @param parent ViewGroup
* @return View
*/
@Override
public View getChildView(int groupPosition, final int childPosition, boolean isLastChild, View convertView, ViewGroup parent)
{
final String childText = (String) getChild(groupPosition, childPosition);
if (convertView == null)
{
LayoutInflater inflater = (LayoutInflater) this.context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(android.R.layout.simple_list_item_multiple_choice, null);
}
CheckedTextView txtListChild = (CheckedTextView) convertView;
txtListChild.setPadding(PADDING, PADDING, PADDING, PADDING);
txtListChild.setText(childText);
return convertView;
}
示例7: getView
import android.widget.CheckedTextView; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = ((Activity)getContext()).getLayoutInflater();
View row = inflater.inflate(R.layout.listitem, parent, false);
ImageView imageView = (ImageView)row.findViewById(R.id.image);
imageView.setImageResource(resourceIds[position]);
CheckedTextView checkedTextView = (CheckedTextView)row.findViewById(
R.id.check);
checkedTextView.setText(getItem(position));
if (position == index) {
checkedTextView.setChecked(true);
}
return row;
}
示例8: getView
import android.widget.CheckedTextView; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = ((Activity) getContext()).getLayoutInflater();
View row = inflater.inflate(R.layout.preference_language, parent, false);
ImageView imageView = (ImageView)row.findViewById(R.id.lanpref_image);
imageView.setImageResource(resourceIds[position]);
CheckedTextView checkedTextView = (CheckedTextView)row.findViewById(
R.id.lanpref_check);
checkedTextView.setText(getItem(position));
if (position == index) {
checkedTextView.setChecked(true);
}
return row;
}
示例9: configureView
import android.widget.CheckedTextView; //导入方法依赖的package包/类
/**
* Construit une vue sur base du layout joueur_list_view_item et
* de l'élément courant du curseur
* @param context
* @param convertView
* @param cursor
* @return
*/
public View configureView(Context context, View convertView, Cursor cursor) {
final Commentaire commentaire = DAO.getCommentaireFromCursor(cursor);
final CheckedTextView texteC = (CheckedTextView)convertView.findViewById(R.id.item_commentaire_etablissement);
texteC.setText(commentaire.getTexte());
texteC.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (texteC.isChecked()) {
texteC.setChecked(false);
listeCommDel.remove(new Integer(commentaire.getId()));
Log.i("TAILLE arraylist :", "apres un remove :" + listeCommDel.size());
} else {
texteC.setChecked(true);
listeCommDel.add(commentaire.getId());
Log.i("TAILLE arraylist :", "apres un add :" + listeCommDel.size());
}
}
});
return convertView;
}
示例10: setupTopModulePager
import android.widget.CheckedTextView; //导入方法依赖的package包/类
protected void setupTopModulePager(LayoutInflater inflater, ViewGroup container, View view, String[] buttonTitles) {
int dp4 = DisplayUtils.dpToPx(view.getContext(), 4);
int dp80 = DisplayUtils.dpToPx(view.getContext(), 80);
for (int i = 0; i < buttonTitles.length; i++) {
CheckedTextView rb = (CheckedTextView) inflater.inflate(R.layout.stats_top_module_pager_button, container, false);
RadioGroup.LayoutParams params = new RadioGroup.LayoutParams(RadioGroup.LayoutParams.MATCH_PARENT,
RadioGroup.LayoutParams.WRAP_CONTENT);
params.weight = 1;
rb.setTypeface((TypefaceCache.getTypeface(view.getContext())));
if (i == 0) {
params.setMargins(0, 0, dp4, 0);
} else {
params.setMargins(dp4, 0, 0, 0);
}
rb.setMinimumWidth(dp80);
rb.setGravity(Gravity.CENTER);
rb.setLayoutParams(params);
rb.setText(buttonTitles[i]);
rb.setChecked(i == mTopPagerSelectedButtonIndex);
rb.setOnClickListener(TopModulePagerOnClickListener);
mTopPagerContainer.addView(rb);
}
mTopPagerContainer.setVisibility(View.VISIBLE);
}
示例11: getView
import android.widget.CheckedTextView; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View v = super.getView(position, convertView, parent);
Drawable d = v.getBackground();
d.setColorFilter(getItem(position), PorterDuff.Mode.MULTIPLY);
v.setBackgroundDrawable(d);
Drawable check = null;
CheckedTextView checked = ((CheckedTextView) v);
if (mSelected == position) {
check = getCheckDrawable();
}
checked.setCompoundDrawables(check, null, null, null);
checked.setText("");
return v;
}
示例12: bindView
import android.widget.CheckedTextView; //导入方法依赖的package包/类
@Override
public void bindView(View view, Context context, Cursor cursor) {
CheckedTextView textView = (CheckedTextView) view;
textView.setText(cursor.getString(cursor.getColumnIndexOrThrow(Table.Event.NAME)));
String eventId = cursor.getString(cursor.getColumnIndexOrThrow(Table.Event.ID));
view.setTag(eventId);
if (textView.getPaddingLeft() > 0) { // on Dropdown
long endTime = cursor.getLong(cursor.getColumnIndexOrThrow(Table.Event.END_TIME));
if (TextUtils.equals(mCurrentEventId, eventId)) {
textView.setTextColor(mTextColorCurrent);
} else if (endTime * 1000 < System.currentTimeMillis()) { // Past
textView.setTextColor(mTextColorPast);
} else {
textView.setTextColor(mTextColorDefault);
}
} else { // on Toolbar
textView.setTextColor(mTextColorInverse);
}
}
示例13: setDebugInfo
import android.widget.CheckedTextView; //导入方法依赖的package包/类
private void setDebugInfo()
{
PodEmuLog.checkPermissions();
String enableDebug = sharedPref.getString("enableDebug", "false");
TextView enableDebugValue = (TextView) findViewById(R.id.enableDebugValue);
CheckedTextView enableDebugHint = (CheckedTextView) findViewById(R.id.enableDebugHint);
if( enableDebug.equals("true") )
{
enableDebugValue.setText("Debug Enabled");
enableDebugHint.setChecked(true);
}
else
{
enableDebugValue.setText("Debug Disabled");
enableDebugHint.setChecked(false);
}
enableDebugHint.setText(getResources().getString(R.string.enable_debug_hint) +
" Logs will be saved to the following file: " + PodEmuLog.getLogFileName());
}
示例14: onCreate
import android.widget.CheckedTextView; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
findViewById(R.id.thread_demo).setOnClickListener(v -> startActivity(new Intent(this, DemoActivity.class)));
check1 = (CheckedTextView) findViewById(R.id.check1);
check2 = (CheckedTextView) findViewById(R.id.check2);
check1.setText(MainState.NAME_1);
check2.setText(MainState.NAME_2);
check1.setOnClickListener(v -> switchTo(MainState.NAME_1));
check2.setOnClickListener(v -> switchTo(MainState.NAME_2));
ListView listView = (ListView) findViewById(R.id.listView);
listView.setAdapter(adapter = new ArrayAdapter<>(this, R.layout.item));
}
示例15: bindView
import android.widget.CheckedTextView; //导入方法依赖的package包/类
@Override
public void bindView(View view, Context context, Cursor cursor) {
CheckableLinearLayout checkme = (CheckableLinearLayout)view;
CheckedTextView base_url_view = (CheckedTextView) view.findViewById(R.id.ServerItem_Url);
if (URL_IDX == -1) {
URL_IDX = cursor.getColumnIndex(DBHelper.BASE_URL);
}
if (DEF_IDX == -1) {
DEF_IDX = cursor.getColumnIndex(DBHelper.SERVER_DEFAULT);
}
boolean isChecked = (cursor.getInt(DEF_IDX) == 1);
String base_url = cursor.getString(URL_IDX);
Log.d(LOG_TAG, "def flag: "+cursor.getInt(DEF_IDX));
checkme.setChecked(isChecked);
base_url_view.setText(base_url);
if (isChecked) {
Log.d(LOG_TAG, base_url + " is the default");
curId = cursor.getLong(cursor.getColumnIndex(DBHelper.COLUMN_ID));
}
}