當前位置: 首頁>>代碼示例>>Java>>正文


Java CheckedTextView.setCheckMarkDrawable方法代碼示例

本文整理匯總了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();

                }

            }

        }

    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:29,代碼來源:Tool.java

示例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);
    }
}
 
開發者ID:iQuick,項目名稱:NewsMe,代碼行數:17,代碼來源:MDTintHelper.java

示例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);
    }
}
 
開發者ID:iQuick,項目名稱:AndroidTint,代碼行數:17,代碼來源:EmTintUtils.java

示例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;
}
 
開發者ID:GermainZ,項目名稱:DynamicAlarmIcon,代碼行數:21,代碼來源:ImageListPreference.java

示例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;
}
 
開發者ID:GermainZ,項目名稱:Identiconizer,代碼行數:23,代碼來源:ImageListPreference.java

示例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;
}
 
開發者ID:doc-rj,項目名稱:smartcard-reader,代碼行數:17,代碼來源:AppEditActivity.java

示例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;
}
 
開發者ID:gandulf,項目名稱:DsaTab,代碼行數:21,代碼來源:BodyLayout.java

示例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;
}
 
開發者ID:sunnygoyal,項目名稱:PowerToggles,代碼行數:12,代碼來源:BrightModeListPref.java

示例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;
}
 
開發者ID:sunnygoyal,項目名稱:PowerToggles,代碼行數:11,代碼來源:AbstractPopupPref.java

示例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;
}
 
開發者ID:ldsddn,項目名稱:wordpress_app_android,代碼行數:36,代碼來源:StatsVisitorsAndViewsFragment.java

示例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;
}
 
開發者ID:mogoweb,項目名稱:365browser,代碼行數:37,代碼來源:SelectPopupAdapter.java

示例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;
}
 
開發者ID:Pixate,項目名稱:pixate-freestyle-android,代碼行數:41,代碼來源:PXVirtualCheckedTextViewIconAdapter.java

示例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);
	}
}
 
開發者ID:soeminnminn,項目名稱:EngMyanDictionary,代碼行數:11,代碼來源:FavoritesListAdapter.java

示例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;
}
 
開發者ID:SilentCircle,項目名稱:silent-contacts-android,代碼行數:14,代碼來源:GroupMembershipView.java

示例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;
}
 
開發者ID:anvo,項目名稱:piqwi,代碼行數:12,代碼來源:PlayerListAdapter.java


注:本文中的android.widget.CheckedTextView.setCheckMarkDrawable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。