本文整理汇总了Java中android.widget.CheckedTextView.setChecked方法的典型用法代码示例。如果您正苦于以下问题:Java CheckedTextView.setChecked方法的具体用法?Java CheckedTextView.setChecked怎么用?Java CheckedTextView.setChecked使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.CheckedTextView
的用法示例。
在下文中一共展示了CheckedTextView.setChecked方法的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: setTabsDisplay
import android.widget.CheckedTextView; //导入方法依赖的package包/类
/**
* 设置底部导航中图片显示状态和字体颜色
*/
public void setTabsDisplay(int index) {
if (mAttrTa != null) {
int isSpecial = mAttrTa.getInt(index, 0);
if (isSpecial != 0) {
return;
}
}
int size = mCheckedList.size();
for (int i = 0; i < size; i++) {
CheckedTextView checkedTextView = mCheckedList.get(i);
if ((Integer) (checkedTextView.getTag()) == index) {
LogUtils.i(mLabels[index] + " is selected...");
checkedTextView.setChecked(true);
} else {
checkedTextView.setChecked(false);
}
}
}
示例4: 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;
}
示例5: 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;
}
示例6: 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;
}
示例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: 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);
}
示例10: singleToggle
import android.widget.CheckedTextView; //导入方法依赖的package包/类
private void singleToggle(View view, String tag){
if(view instanceof CheckedTextView) {
CheckedTextView check = ((CheckedTextView)view);
if(check.getText().equals(tag)){
check.setChecked(false);
}
}
//If a layout container, iterate over children and seed recursion.
if (view instanceof ViewGroup) {
for (int i = 0; i < ((ViewGroup) view).getChildCount(); i++) {
View innerView = ((ViewGroup) view).getChildAt(i);
singleToggle(innerView, tag);
}
}
}
示例11: 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());
}
示例12: setToggleForceSimpleMode
import android.widget.CheckedTextView; //导入方法依赖的package包/类
private void setToggleForceSimpleMode()
{
int forceSimpleMode = sharedPref.getInt("ForceSimpleMode", 0);
RelativeLayout layout = (RelativeLayout) findViewById(R.id.playlistCountLayout);
CheckedTextView toggleForceSimpleModeView = (CheckedTextView) findViewById(R.id.forceSimpleModeHint);
if( forceSimpleMode == 1 )
{
toggleForceSimpleModeView.setChecked(true);
if ( enableListCountSelection ) layout.setVisibility(View.INVISIBLE);
}
else
{
toggleForceSimpleModeView.setChecked(false);
if ( enableListCountSelection ) layout.setVisibility(View.VISIBLE);
}
}
示例13: getInstance
import android.widget.CheckedTextView; //导入方法依赖的package包/类
public ArrayAdapter<String> getInstance(final Context pContext) {
return new ArrayAdapter<String>(pContext, android.R.layout.simple_spinner_item, names) {
@Override
public View getDropDownView(final int pPosition, final View pConvertView, final ViewGroup pParent) {
final View view;
if (pConvertView == null) {
// TODO http://www.doubleencore.com/2013/05/layout-inflation-as-intended/
view = View.inflate(getApplicationContext(), R.layout.sender_list_item, null);
} else {
view = pConvertView;
}
final ImageView iconView = (ImageView) view.findViewById(R.id.sender_icon);
iconView.setImageDrawable(icons.get(pPosition));
final CheckedTextView tv = (CheckedTextView) view.findViewById(android.R.id.text1);
tv.setText(names.get(pPosition));
tv.setChecked(pPosition == mSenderSpinner.getSelectedItemPosition());
return view;
}
};
}
示例14: bindView
import android.widget.CheckedTextView; //导入方法依赖的package包/类
@Override
public void bindView(View view, Context context, Cursor cursor) {
final Integer id = cursor.getInt(0);
final ImageView visibility = (ImageView) view.findViewById(R.id.iv_visibility);
visibility.setImageDrawable(cursor.getInt(2) != 0 ? mVisibilityOn : mVisibilityOff);
visibility.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
boolean isVisible = visibility.getDrawable().equals(mVisibilityOn);
updateRecord(id, !isVisible);
}
});
CheckedTextView name = (CheckedTextView) view.findViewById(R.id.tv_name);
name.setChecked(mSelectedIds.contains(id + ""));
name.setText(cursor.getString(1));
}
示例15: updateConfigSource
import android.widget.CheckedTextView; //导入方法依赖的package包/类
private void updateConfigSource() {
int n = mSourceContainer.getChildCount();
if(mSourceContainer.getChildAt(0).getId() == R.id.empty) {
return;
}
List<String> list = PreferenceHelper.selectedCategoriesFromPref(this);
mSelectedSet = new HashSet<String>();
for (String s : list) {
//Log.d(TAG, "add " + s);
mSelectedSet.add(s);
}
for (int i=0;i<n;i++) {
CheckedTextView tv = (CheckedTextView) mSourceContainer.getChildAt(i);
tv.setChecked(mSelectedSet.contains((String)tv.getText()));
}
}