本文整理汇总了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);
}
}
示例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);
}
}
示例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);
}
示例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);
}
示例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));
}
}
示例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));
}
}