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


Java AppCompatCheckBox.setSupportButtonTintList方法代碼示例

本文整理匯總了Java中android.support.v7.widget.AppCompatCheckBox.setSupportButtonTintList方法的典型用法代碼示例。如果您正苦於以下問題:Java AppCompatCheckBox.setSupportButtonTintList方法的具體用法?Java AppCompatCheckBox.setSupportButtonTintList怎麽用?Java AppCompatCheckBox.setSupportButtonTintList使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.support.v7.widget.AppCompatCheckBox的用法示例。


在下文中一共展示了AppCompatCheckBox.setSupportButtonTintList方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: ImageHolder

import android.support.v7.widget.AppCompatCheckBox; //導入方法依賴的package包/類
ImageHolder(View itemView, int itemSize, boolean hasCamera, @Album.ChoiceMode int choiceMode, ColorStateList selector,
            OnItemClickListener itemClickListener, OnItemCheckedListener itemCheckedListener) {
    super(itemView);
    itemView.getLayoutParams().height = itemSize;

    this.itemSize = itemSize;
    this.hasCamera = hasCamera;
    this.mChoiceMode = choiceMode;
    this.mItemClickListener = itemClickListener;
    this.mItemCheckedListener = itemCheckedListener;

    mIvImage = (ImageView) itemView.findViewById(R.id.iv_album_content_image);
    mCheckBox = (AppCompatCheckBox) itemView.findViewById(R.id.cb_album_check);
    mLayoutLayer = (FrameLayout) itemView.findViewById(R.id.layout_layer);

    itemView.setOnClickListener(this);
    mCheckBox.setOnClickListener(this);
    mLayoutLayer.setOnClickListener(this);
    if (mChoiceMode == Album.MODE_MULTIPLE) {
        mCheckBox.setVisibility(View.VISIBLE);
        mCheckBox.setSupportButtonTintList(selector);
    } else {
        mCheckBox.setVisibility(View.GONE);
    }
}
 
開發者ID:WeiXinqiao,項目名稱:Recognize-it,代碼行數:26,代碼來源:AlbumFileAdapter.java

示例2: VideoHolder

import android.support.v7.widget.AppCompatCheckBox; //導入方法依賴的package包/類
VideoHolder(View itemView, int itemSize, boolean hasCamera, @Album.ChoiceMode int choiceMode, ColorStateList selector,
            OnItemClickListener itemClickListener, OnItemCheckedListener itemCheckedListener) {
    super(itemView);
    itemView.getLayoutParams().height = itemSize;

    this.itemSize = itemSize;
    this.hasCamera = hasCamera;
    this.mChoiceMode = choiceMode;
    this.mItemClickListener = itemClickListener;
    this.mItemCheckedListener = itemCheckedListener;

    mIvImage = (ImageView) itemView.findViewById(R.id.iv_album_content_image);
    mCheckBox = (AppCompatCheckBox) itemView.findViewById(R.id.cb_album_check);
    mTvDuration = (TextView) itemView.findViewById(R.id.tv_duration);
    mLayoutLayer = (FrameLayout) itemView.findViewById(R.id.layout_layer);

    itemView.setOnClickListener(this);
    mCheckBox.setOnClickListener(this);
    mLayoutLayer.setOnClickListener(this);
    if (mChoiceMode == Album.MODE_MULTIPLE) {
        mCheckBox.setVisibility(View.VISIBLE);
        mCheckBox.setSupportButtonTintList(selector);
    } else {
        mCheckBox.setVisibility(View.GONE);
    }
}
 
開發者ID:WeiXinqiao,項目名稱:Recognize-it,代碼行數:27,代碼來源:AlbumFileAdapter.java

示例3: setupCheckbox

import android.support.v7.widget.AppCompatCheckBox; //導入方法依賴的package包/類
/**
 * Setups checkbox in menu.
 * @param menu menu
 */
private void setupCheckbox(Menu menu)
{
	AppCompatCheckBox checkBox = (AppCompatCheckBox) menu.findItem(R.id.equalizer_lock).getActionView();
	ColorStateList colorStateList = new ColorStateList(new int[][]{
			new int[]{-android.R.attr.state_enabled}, // disabled
			new int[]{android.R.attr.state_enabled}, // enabled
	},
			new int[]{
					Color.WHITE, // disabled
					Color.WHITE // enabled
			});
	checkBox.setSupportButtonTintList(colorStateList);
	checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
		@Override
		public void onCheckedChanged(CompoundButton compoundButton, boolean b)
		{
			lockedSliders = b;
		}
	});
	checkBox.setText(getString(R.string.lock_sliders));
	checkBox.setChecked(true);
	checkBox.setPadding(0,0,Math.round(getResources().getDimension(R.dimen.activity_horizontal_margin)),0);
}
 
開發者ID:JiriSko,項目名稱:amixer-webui-android,代碼行數:28,代碼來源:EqualizerActivity.java

示例4: addMultipleChoice

import android.support.v7.widget.AppCompatCheckBox; //導入方法依賴的package包/類
public void addMultipleChoice(String text, boolean checked, final OnCheckListener listener) {
    ColorStateList colorStateList = new ColorStateList(
            new int[][]{
                    new int[]{-android.R.attr.state_enabled}, //disabled
                    new int[]{android.R.attr.state_enabled}, //enabled
                    new int[]{android.R.attr.state_checked}
            },
            new int[]{
                    R.color.checkbox_disabled_color, //disabled
                    R.color.checkbox_enabled_color, //enabled
                    R.color.checkbox_checked_color
            }
    );

    AppCompatCheckBox box = new AppCompatCheckBox(getContext());
    box.setChecked(checked);
    box.setSupportButtonTintList(colorStateList);
    box.setText(localize(text));
    box.setTextColor(getResources().getColor(R.color.text_dark));
    box.setOnCheckedChangeListener(new OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            listener.onCheck(isChecked);
        }
    });
    mCheckBoxes.addView(box);
}
 
開發者ID:suomenriistakeskus,項目名稱:oma-riista-android,代碼行數:28,代碼來源:ChoiceView.java

示例5: updateVisibilityFormat

import android.support.v7.widget.AppCompatCheckBox; //導入方法依賴的package包/類
private void updateVisibilityFormat(ProductItem item)
{
    Resources resources = cache.getActivity().getResources();
    TextView productNameTextView = productItemCache.getProductNameTextView();
    TextView productQuantityTextView = productItemCache.getQuantityTextView();
    TextView quantityTextView = productItemCache.getQuantityTextView();
    CardView productCard = productItemCache.getProductCard();
    AppCompatCheckBox checkbox = (AppCompatCheckBox) productItemCache.getCheckbox();

    if ( item.isChecked() )
    {
        int grey = resources.getColor(R.color.middlegrey);
        productCard.setCardBackgroundColor(resources.getColor(R.color.transparent));
        checkbox.setSupportButtonTintList(ColorStateList.valueOf(resources.getColor(R.color.middleblue)));
        productNameTextView.setTextColor(grey);
        quantityTextView.setTextColor(grey);
        productNameTextView.setPaintFlags(productNameTextView.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
        productQuantityTextView.setPaintFlags(productQuantityTextView.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
    }
    else
    {
        int black = resources.getColor(R.color.black);
        productCard.setCardBackgroundColor(resources.getColor(R.color.white));
        checkbox.setSupportButtonTintList(ColorStateList.valueOf(resources.getColor(R.color.colorAccent)));
        productNameTextView.setTextColor(black);
        quantityTextView.setTextColor(black);
        productNameTextView.setPaintFlags(productNameTextView.getPaintFlags() & (~Paint.STRIKE_THRU_TEXT_FLAG));
        productQuantityTextView.setPaintFlags(productQuantityTextView.getPaintFlags() & (~Paint.STRIKE_THRU_TEXT_FLAG));
    }

}
 
開發者ID:SecUSo,項目名稱:privacy-friendly-shopping-list,代碼行數:32,代碼來源:ProductsItemViewHolder.java

示例6: updateVisibilityFormat

import android.support.v7.widget.AppCompatCheckBox; //導入方法依賴的package包/類
private void updateVisibilityFormat(ProductItem item)
{
    Resources resources = deleteProductItemCache.getProductCard().getContext().getResources();
    TextView productNameTextView = deleteProductItemCache.getProductNameTextView();
    TextView productQuantityTextView = deleteProductItemCache.getProductQuantityTextView();
    AppCompatCheckBox checkBox = (AppCompatCheckBox) deleteProductItemCache.getCheckBox();
    if ( item.isSelectedForDeletion() )
    {
        int transparent = resources.getColor(R.color.transparent);
        int grey = resources.getColor(R.color.middlegrey);

        deleteProductItemCache.getProductCard().setCardBackgroundColor(transparent);
        productNameTextView.setTextColor(grey);
        productQuantityTextView.setTextColor(grey);
        checkBox.setSupportButtonTintList(ColorStateList.valueOf(grey));
        productNameTextView.setPaintFlags(productNameTextView.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
        productQuantityTextView.setPaintFlags(productQuantityTextView.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
    }
    else
    {
        int white = resources.getColor(R.color.white);
        int black = resources.getColor(R.color.black);

        deleteProductItemCache.getProductCard().setCardBackgroundColor(white);
        productNameTextView.setTextColor(black);
        productQuantityTextView.setTextColor(black);
        checkBox.setSupportButtonTintList(ColorStateList.valueOf(black));
        productNameTextView.setPaintFlags(productNameTextView.getPaintFlags() & (~Paint.STRIKE_THRU_TEXT_FLAG));
        productQuantityTextView.setPaintFlags(productQuantityTextView.getPaintFlags() & (~Paint.STRIKE_THRU_TEXT_FLAG));
    }
}
 
開發者ID:SecUSo,項目名稱:privacy-friendly-shopping-list,代碼行數:32,代碼來源:DeleteProductsItemViewHolder.java


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