本文整理匯總了Java中android.widget.CheckedTextView類的典型用法代碼示例。如果您正苦於以下問題:Java CheckedTextView類的具體用法?Java CheckedTextView怎麽用?Java CheckedTextView使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
CheckedTextView類屬於android.widget包,在下文中一共展示了CheckedTextView類的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: setListItemsStyle
import android.widget.CheckedTextView; //導入依賴的package包/類
private static void setListItemsStyle(ConfigBean bean) {
if(bean.type == DefaultConfig.TYPE_MD_SINGLE_CHOOSE || bean.type == DefaultConfig.TYPE_MD_MULTI_CHOOSE){
ListView listView = bean.alertDialog.getListView();
// listView.getAdapter().
if(listView!=null && listView.getAdapter() !=null){
int count = listView.getChildCount();
for(int i=0;i<count;i++){
View childAt = listView.getChildAt(i);
if(childAt ==null){
continue;
}
CheckedTextView itemView = (CheckedTextView) childAt.findViewById(android.R.id.text1);
Log.e("dd",itemView+"-----"+ i);
if(itemView !=null) {
itemView.setCheckMarkDrawable(R.drawable.bg_toast);
//itemView.setCheckMarkTintList();
// itemView.setCheckMarkTintList();
//itemView.setCheckMarkTintList();
}
}
}
}
}
示例3: 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;
}
示例4: getView
import android.widget.CheckedTextView; //導入依賴的package包/類
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (convertView == null) {
LayoutInflater inflater = ((Activity) getContext()).getLayoutInflater();
convertView = inflater.inflate(R.layout.data_storage_location_item, parent, false);
holder = new ViewHolder();
holder.titleTextView = (TextView) convertView.findViewById(R.id.storage_label);
holder.summaryTextView = (TextView) convertView.findViewById(R.id.available_free_space);
holder.checkedTextView = (CheckedTextView) convertView.findViewById(R.id.checked_text_view);
convertView.setTag(holder);
}
holder = (ViewHolder) convertView.getTag();
holder.titleTextView.setText(getItem(position));
holder.summaryTextView.setText(mFreeSpaces[position]);
holder.checkedTextView.setText(null); // we have a 'custom' label
if (position == mSelectedIndex) {
holder.checkedTextView.setChecked(true);
}
return convertView;
}
示例5: 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);
}
}
}
示例6: 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;
}
示例7: onCreate
import android.widget.CheckedTextView; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_settings_stream_player);
settings = new Settings(getBaseContext());
mShowNavigationBarView = (CheckedTextView) findViewById(R.id.player_show_navigation_title);
mShowViewCountView = (CheckedTextView) findViewById(R.id.player_show_viewercount_title);
mAutoPlaybackView = (CheckedTextView) findViewById(R.id.player_auto_continue_playback_title);
mShowViewCountSummary = (TextView) findViewById(R.id.player_show_viewercount_title_summary);
mShowNavigationBarSummary = (TextView) findViewById(R.id.player_show_navigation_summary);
mAutoPlaybackSummary = (TextView) findViewById(R.id.player_auto_continue_playback_summary);
final Toolbar toolbar = (Toolbar) findViewById(R.id.settings_player_toolbar);
setSupportActionBar(toolbar);
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setTitle(getString(R.string.settings_stream_player_name));
}
updateSummaries();
}
示例8: onCreate
import android.widget.CheckedTextView; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_settings_twitch_chat);
settings = new Settings(getBaseContext());
final Toolbar toolbar = (Toolbar) findViewById(R.id.settings_player_toolbar);
setSupportActionBar(toolbar);
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
emoteSizeSummary = (TextView) findViewById(R.id.chat_emote_size_summary);
messageSizeSummary = (TextView) findViewById(R.id.message_size_summary);
emoteStorageSummary = (TextView) findViewById(R.id.emote_storage_summary);
chatLandscapeWidthSummary = (TextView) findViewById(R.id.chat_landscape_summary);
chatLandscapeToggleSummary = (TextView) findViewById(R.id.chat_landscape_enable_summary);
chatLandscapeSwipeToShowSummary = (TextView) findViewById(R.id.chat_landscape_swipe_summary);
chatLandscapeToggle = (CheckedTextView) findViewById(R.id.chat_landscape_enable_title);
chatSwipeToShowToggle = (CheckedTextView) findViewById(R.id.chat_landscape_swipe_title);
updateSummaries();
}
示例9: 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;
}
示例10: 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;
}
示例11: 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;
}
示例12: getView
import android.widget.CheckedTextView; //導入依賴的package包/類
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.activity_user_tags_list_item, parent, false);
holder = new ViewHolder();
holder.tag = (CheckedTextView) convertView.findViewById(R.id.name);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
TagObject data = new TagObject((JSONObject) getItem(position));
holder.tag.setText(data.getmTagName());
if (mHashSet.contains(data.getmTagId())) {
holder.tag.setChecked(true);
} else {
holder.tag.setChecked(false);
}
return convertView;
}
示例13: 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;
}
示例14: setTint
import android.widget.CheckedTextView; //導入依賴的package包/類
public static void setTint(@NonNull CheckedTextView textView, @ColorInt int color) {
ColorStateList sl = new ColorStateList(new int[][]{
new int[]{-android.R.attr.state_checked},
new int[]{android.R.attr.state_checked}
}, new int[]{
ThemeHelper.resolveColor(textView.getContext(), R.attr.colorControlNormal),
color
});
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
textView.setCheckMarkTintList(sl);
} else {
Drawable d = DrawableCompat.wrap(ContextCompat.getDrawable(textView.getContext(), R.drawable.abc_btn_radio_material));
DrawableCompat.setTintList(d, sl);
textView.setCheckMarkDrawable(d);
}
}
示例15: getView
import android.widget.CheckedTextView; //導入依賴的package包/類
@Override
public View getView(final int position, View convertView, ViewGroup parent){
final View v;
ViewHolder holder;
if(convertView == null){
v = LayoutInflater.from(ctx).inflate(R.layout.row_facebook_invite_friends, parent, false);
holder = new ViewHolder();
holder.name = (CheckedTextView) v.findViewById(R.id.username);
holder.avatarImage = (ImageView) v.findViewById(R.id.user_avatar);
v.setTag(holder);
} else {
holder = (ViewHolder)convertView.getTag();
v = convertView;
}
Friend friend = getItem(position);
holder.name.setChecked(((ListView)parent).isItemChecked(position));
holder.name.setText(friend.getUsername());
Log.d("AptoideDebug", friend.getUsername());
Glide.with(ctx).load(friend.getAvatar()).transform(new CircleTransform(ctx)).into(holder.avatarImage);
return v;
}