本文整理汇总了Java中android.widget.CheckedTextView.setCheckMarkDrawable方法的典型用法代码示例。如果您正苦于以下问题:Java CheckedTextView.setCheckMarkDrawable方法的具体用法?Java CheckedTextView.setCheckMarkDrawable怎么用?Java CheckedTextView.setCheckMarkDrawable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.CheckedTextView
的用法示例。
在下文中一共展示了CheckedTextView.setCheckMarkDrawable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
}
}
}
}
示例2: 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);
}
}
示例3: 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_check_material));
DrawableCompat.setTintList(d, sl);
textView.setCheckMarkDrawable(d);
}
}
示例4: 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.image_list_item, 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));
checkedTextView.setCheckMarkDrawable(Resources.getSystem().getDrawable(mRadioDrawableId));
if (position == index)
checkedTextView.setChecked(true);
return row;
}
示例5: 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.image_list_item, 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));
checkedTextView.setCheckMarkDrawable(Resources.getSystem().getDrawable(mRadioDrawableId));
if (position == index) {
checkedTextView.setChecked(true);
}
return row;
}
示例6: getView
import android.widget.CheckedTextView; //导入方法依赖的package包/类
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
final View itemView = super.getView(position, convertView, parent);
if (itemView == null) {
return null;
}
final CheckedTextView checkedTextView = (CheckedTextView)itemView;
if (hasCheckbox(position)) {
checkedTextView.setEnabled(isEnabled(position));
} else {
checkedTextView.setCheckMarkDrawable(null);
checkedTextView.setTextColor(getResources().getColor(R.color.accent));
}
return checkedTextView;
}
示例7: addArmorButton
import android.widget.CheckedTextView; //导入方法依赖的package包/类
protected TextView addArmorButton(Position pos) {
CheckedTextView rsText = new CheckedTextView(getContext());
rsText.setCheckMarkDrawable(0);
rsText.setBackgroundResource(R.drawable.icon_armor_btn);
rsText.setOnClickListener(onArmorClickListener);
rsText.setOnLongClickListener(onArmorLongClickListener);
rsText.setGravity(Gravity.CENTER);
rsText.setTextColor(getResources().getColor(android.R.color.primary_text_light));
addView(rsText, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, null, pos));
armorButtons.put(pos, rsText);
rsText.measure(rsWidthMeasureSpec, rsHeightMeasureSpec);
rsText.setTextSize(TypedValue.COMPLEX_UNIT_PX, rsText.getMeasuredHeight() / 1.7f);
return rsText;
}
示例8: getNewListItem
import android.widget.CheckedTextView; //导入方法依赖的package包/类
private TextView getNewListItem(int value) {
CheckedTextView tv = (CheckedTextView) mInflator.inflate(R.layout.ts_pref_checkbox, null);
tv.setCheckMarkDrawable(new PathDrawable(PATH_CROSS, mContext, 15));
tv.setBackgroundResource(R.drawable.bg_top_gray_divider);
tv.setOnClickListener(this);
int percent = value * 100 / 255;
tv.setText(String.format("%d (%d%% of 255)", value, percent));
tv.setTag(value);
return tv;
}
示例9: AbstractPopupPref
import android.widget.CheckedTextView; //导入方法依赖的package包/类
AbstractPopupPref(LayoutInflater inflator, SharedPreferences prefs, int textId, int itemLayout) {
super(inflator.getContext(), itemLayout);
mPrefs = prefs;
view = (CheckedTextView) inflator.inflate(R.layout.ts_pref_checkbox, null);
view.setCheckMarkDrawable(new PathDrawable(PATH_POPUP, getContext(), 18));
view.setText(textId);
view.setOnClickListener(this);
mInflator = inflator;
}
示例10: onCreateView
import android.widget.CheckedTextView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.stats_visitors_and_views_fragment, container, false);
mDateTextView = (TextView) view.findViewById(R.id.stats_summary_date);
mGraphContainer = (LinearLayout) view.findViewById(R.id.stats_bar_chart_fragment_container);
mModuleButtonsContainer = (LinearLayout) view.findViewById(R.id.stats_pager_tabs);
mLegendContainer = (LinearLayout) view.findViewById(R.id.stats_legend_container);
mLegendLabel = (CheckedTextView) view.findViewById(R.id.stats_legend_label);
mLegendLabel.setCheckMarkDrawable(null); // Make sure to set a null drawable here. Otherwise the touching area is the same of a TextView
mVisitorsCheckboxContainer = (LinearLayout) view.findViewById(R.id.stats_checkbox_visitors_container);
mVisitorsCheckbox = (CheckBox) view.findViewById(R.id.stats_checkbox_visitors);
mVisitorsCheckbox.setOnClickListener(onCheckboxClicked);
// Fix an issue on devices with 4.1 or lower, where the Checkbox already uses padding by default internally and overriding it with paddingLeft
// causes the issue report here https://github.com/wordpress-mobile/WordPress-Android/pull/2377#issuecomment-77067993
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
mVisitorsCheckbox.setPadding(getResources().getDimensionPixelSize(R.dimen.margin_medium), 0, 0, 0);
}
// Make sure we've all the info to build the tab correctly. This is ALWAYS true
if (mModuleButtonsContainer.getChildCount() == overviewItems.length) {
for (int i = 0; i < mModuleButtonsContainer.getChildCount(); i++) {
LinearLayout currentTab = (LinearLayout) mModuleButtonsContainer.getChildAt(i);
boolean isLastItem = i == (overviewItems.length - 1);
boolean isChecked = i == mSelectedOverviewItemIndex;
TabViewHolder currentTabViewHolder = new TabViewHolder(currentTab, overviewItems[i], isChecked, isLastItem);
currentTab.setOnClickListener(TopButtonsOnClickListener);
currentTab.setTag(currentTabViewHolder);
}
mModuleButtonsContainer.setVisibility(View.VISIBLE);
}
return view;
}
示例11: getView
import android.widget.CheckedTextView; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (position < 0 || position >= getCount()) return null;
convertView = super.getView(position, convertView, parent);
((TextView) convertView).setText(mItems.get(position).getLabel());
// Currently select_dialog_(single|multi)choice uses CheckedTextViews.
// If that changes, the class cast will no longer be valid.
// The WebView build cannot rely on this being the case, so
// we must check.
if (convertView instanceof CheckedTextView) {
// <optgroup> elements do not have check marks. If an item previously used as an
// <optgroup> gets reused for a non-<optgroup> element, we need to get the check mark
// back. Inflating a new View from XML can be slow, for both the inflation part and GC
// afterwards. Even creating a new Drawable can be tricky, considering getting the
// check/radio type and theme right.
// Saving the previously removed Drawables and reuse them when needed is faster,
// and the memory implication should be fine.
CheckedTextView view = (CheckedTextView) convertView;
if (mItems.get(position).getType() == PopupItemType.GROUP) {
if (view.getCheckMarkDrawable() != null) {
view.setTag(view.getCheckMarkDrawable());
view.setCheckMarkDrawable(null);
}
} else {
if (view.getCheckMarkDrawable() == null) {
view.setCheckMarkDrawable((Drawable) view.getTag());
}
}
}
// Draw the disabled element in a disabled state.
convertView.setEnabled(mItems.get(position).getType() != PopupItemType.DISABLED);
return convertView;
}
示例12: updateStyle
import android.widget.CheckedTextView; //导入方法依赖的package包/类
@Override
public boolean updateStyle(List<PXRuleSet> ruleSets, List<PXStylerContext> contexts) {
if (!super.updateStyle(ruleSets, contexts)) {
return false;
}
// Style the check mark. We will construct the
// drawable from the context states, and then set the constructed
// drawable as the check mark using the
// CheckedTextView#setCheckMarkDrawable call. Note that this is
// different than the View#setBackground(Drawable) call that is handled
// in the default View adapter.
CheckedTextView view = (CheckedTextView) contexts.get(0).getStyleable();
Drawable currentDrawable = getCheckMarkDrawable(view);
Map<int[], Drawable> existingStates = PXDrawableUtil.getExistingStates(currentDrawable);
Drawable newDrawable = null;
if (MapUtil.isEmpty(existingStates)) {
// create a new StateListDrawable for the icon,
// using the checked text view's adapter
// as the source of possible drawable states.
if (contexts.size() == 1) {
newDrawable = contexts.get(0).getBackgroundImage();
} else {
newDrawable = PXDrawableUtil.createNewStateListDrawable(
PXStyleAdapter.getStyleAdapter(view), ruleSets, contexts);
}
} else {
// create a drawable that will hold a merge of the existing states
// and the new states. Use the checked text view's
// adapter as the source of possible drawable states.
newDrawable = PXDrawableUtil.createDrawable(PXStyleAdapter.getStyleAdapter(view),
existingStates, ruleSets, contexts);
}
view.setCheckMarkDrawable(newDrawable);
return true;
}
示例13: bindView
import android.widget.CheckedTextView; //导入方法依赖的package包/类
@Override
public void bindView(View view, Context context, Cursor cursor) {
CheckedTextView textViewItemTitle = (CheckedTextView)view;
textViewItemTitle.setText(cursor.getString(mDisplayColumn));
if (mIsCheckable) {
textViewItemTitle.setCheckMarkDrawable(getCheckMarkDrawable(context));
} else {
textViewItemTitle.setCheckMarkDrawable(null);
}
}
示例14: getView
import android.widget.CheckedTextView; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
final View itemView = super.getView(position, convertView, parent);
// Hide the checkable drawable. This assumes that the item views
// are CheckedTextView objects
final CheckedTextView checkedTextView = (CheckedTextView)itemView;
if (!getItemIsCheckable(position)) {
checkedTextView.setCheckMarkDrawable(null);
}
return checkedTextView;
}
示例15: populateView
import android.widget.CheckedTextView; //导入方法依赖的package包/类
protected View populateView(int position, View convertView)
{
Player player = (Player)this.getItem(position);
CheckedTextView text1 = (CheckedTextView)convertView.findViewById(android.R.id.text1);
text1.setText(player.getName());
if(this.selectionMode)
text1.setCheckMarkDrawable(android.R.drawable.btn_radio);
else
text1.setCheckMarkDrawable(R.drawable.empty);
return convertView;
}