本文整理汇总了Java中android.support.v4.widget.CompoundButtonCompat.setButtonTintList方法的典型用法代码示例。如果您正苦于以下问题:Java CompoundButtonCompat.setButtonTintList方法的具体用法?Java CompoundButtonCompat.setButtonTintList怎么用?Java CompoundButtonCompat.setButtonTintList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v4.widget.CompoundButtonCompat
的用法示例。
在下文中一共展示了CompoundButtonCompat.setButtonTintList方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadFromAttributes
import android.support.v4.widget.CompoundButtonCompat; //导入方法依赖的package包/类
void loadFromAttributes(AttributeSet attrs, int defStyleAttr) {
TypedArray a = this.mView.getContext().obtainStyledAttributes(attrs, R.styleable.CompoundButton, defStyleAttr, 0);
try {
if (a.hasValue(R.styleable.CompoundButton_android_button)) {
int resourceId = a.getResourceId(R.styleable.CompoundButton_android_button, 0);
if (resourceId != 0) {
this.mView.setButtonDrawable(this.mDrawableManager.getDrawable(this.mView.getContext(), resourceId));
}
}
if (a.hasValue(R.styleable.CompoundButton_buttonTint)) {
CompoundButtonCompat.setButtonTintList(this.mView, a.getColorStateList(R.styleable.CompoundButton_buttonTint));
}
if (a.hasValue(R.styleable.CompoundButton_buttonTintMode)) {
CompoundButtonCompat.setButtonTintMode(this.mView, DrawableUtils.parseTintMode(a.getInt(R.styleable.CompoundButton_buttonTintMode, -1), null));
}
a.recycle();
} catch (Throwable th) {
a.recycle();
}
}
示例2: loadFromAttributes
import android.support.v4.widget.CompoundButtonCompat; //导入方法依赖的package包/类
final void loadFromAttributes(AttributeSet paramAttributeSet, int paramInt)
{
TypedArray localTypedArray = this.mView.getContext().obtainStyledAttributes(paramAttributeSet, R.styleable.CompoundButton, paramInt, 0);
try
{
if (localTypedArray.hasValue(R.styleable.CompoundButton_android_button))
{
int i = localTypedArray.getResourceId(R.styleable.CompoundButton_android_button, 0);
if (i != 0) {
this.mView.setButtonDrawable(this.mTintManager.getDrawable(i, false));
}
}
if (localTypedArray.hasValue(R.styleable.CompoundButton_buttonTint)) {
CompoundButtonCompat.setButtonTintList(this.mView, localTypedArray.getColorStateList(R.styleable.CompoundButton_buttonTint));
}
if (localTypedArray.hasValue(R.styleable.CompoundButton_buttonTintMode)) {
CompoundButtonCompat.setButtonTintMode(this.mView, DrawableUtils.parseTintMode$49602678(localTypedArray.getInt(R.styleable.CompoundButton_buttonTintMode, -1)));
}
return;
}
finally
{
localTypedArray.recycle();
}
}
示例3: setTheme
import android.support.v4.widget.CompoundButtonCompat; //导入方法依赖的package包/类
@Override
public void setTheme() {
super.setTheme();
int checkTint = ThemeUtils.resolveColor(getContext(), R.attr.gallery_checkbox_button_tint_color, R.color.gallery_default_checkbox_button_tint_color);
CompoundButtonCompat.setButtonTintList(mCbCheck, ColorStateList.valueOf(checkTint));
int cbTextColor = ThemeUtils.resolveColor(getContext(), R.attr.gallery_checkbox_text_color, R.color.gallery_default_checkbox_text_color);
mCbCheck.setTextColor(cbTextColor);
int pageColor = ThemeUtils.resolveColor(getContext(), R.attr.gallery_page_bg, R.color.gallery_default_page_bg);
mRlRootView.setBackgroundColor(pageColor);
}
示例4: BucketViewHolder
import android.support.v4.widget.CompoundButtonCompat; //导入方法依赖的package包/类
BucketViewHolder(ViewGroup parent, View itemView) {
super(itemView);
this.mParentView = parent;
mTvBucketName = (TextView) itemView.findViewById(R.id.tv_bucket_name);
mIvBucketCover = (SquareImageView) itemView.findViewById(R.id.iv_bucket_cover);
mRbSelected = (AppCompatRadioButton) itemView.findViewById(R.id.rb_selected);
itemView.setOnClickListener(this);
int checkTint = ThemeUtils.resolveColor(itemView.getContext(), R.attr.gallery_checkbox_button_tint_color, R.color.gallery_default_checkbox_button_tint_color);
CompoundButtonCompat.setButtonTintList(mRbSelected, ColorStateList.valueOf(checkTint));
}
示例5: GridViewHolder
import android.support.v4.widget.CompoundButtonCompat; //导入方法依赖的package包/类
GridViewHolder(View itemView) {
super(itemView);
mIvMediaImage = itemView.findViewById(R.id.iv_media_image);
mCbCheck = (AppCompatCheckBox) itemView.findViewById(R.id.cb_check);
relativeLayout = (SquareRelativeLayout) itemView.findViewById(R.id.rootView);
mLlCamera = (LinearLayout) itemView.findViewById(R.id.ll_camera);
mTvCameraTxt = (TextView) itemView.findViewById(R.id.tv_camera_txt);
mIvCameraImage = (ImageView) itemView.findViewById(R.id.iv_camera_image);
int checkTint = ThemeUtils.resolveColor(itemView.getContext(), R.attr.gallery_checkbox_button_tint_color, R.color.gallery_default_checkbox_button_tint_color);
CompoundButtonCompat.setButtonTintList(mCbCheck, ColorStateList.valueOf(checkTint));
}
示例6: install
import android.support.v4.widget.CompoundButtonCompat; //导入方法依赖的package包/类
public static void install(CompoundButton checkBox, AttributeSet attrs) {
ThemedView.setupBackground(checkBox, attrs);
if (ThemeHelper.hasCustomAccentColor(checkBox.getContext())) {
CompoundButtonCompat.setButtonTintList(checkBox,
createCheckBoxTintStateList(checkBox.getContext()));
if (Build.VERSION.SDK_INT >= 21 && checkBox.getBackground() instanceof RippleDrawable) {
((RippleDrawable) checkBox.getBackground()).setColor(
createCheckBoxRippleTintStateList(checkBox.getContext()));
}
}
}
示例7: applySkin
import android.support.v4.widget.CompoundButtonCompat; //导入方法依赖的package包/类
@Override
public void applySkin() {
mButtonResourceId = SkinCompatHelper.checkResourceId(mButtonResourceId);
if (mButtonResourceId != INVALID_ID) {
mView.setButtonDrawable(SkinCompatResources.getDrawableCompat(mView.getContext(), mButtonResourceId));
}
mButtonTintResId = SkinCompatHelper.checkResourceId(mButtonTintResId);
if (mButtonTintResId != INVALID_ID) {
CompoundButtonCompat.setButtonTintList(mView, SkinCompatResources.getColorStateList(mView.getContext(), mButtonTintResId));
}
}
示例8: setCheckedTint
import android.support.v4.widget.CompoundButtonCompat; //导入方法依赖的package包/类
public void setCheckedTint(@ColorInt int color) {
CompoundButtonCompat.setButtonTintList(checkBox, ColorStateList.valueOf(color));
}
示例9: initDefaultViews
import android.support.v4.widget.CompoundButtonCompat; //导入方法依赖的package包/类
@NonNull
private View initDefaultViews(@NonNull LayoutInflater inflater, @NonNull ViewGroup container) {
ViewGroup root = (ViewGroup) inflater.inflate(R.layout.introduction_fragment_content, container, false);
ViewGroup descriptionContainer = root.findViewById(R.id.introduction_fragment_content_description_container);
TextView title = root.findViewById(R.id.introduction_fragment_content_title);
ImageView image = root.findViewById(R.id.introduction_fragment_content_image);
TextView description = null;
if (slide.getTitle() != null) {
title.setText(slide.getTitle());
title.setMaxLines(getLineCountForTitle());
title.setTypeface(IntroductionConfiguration.getInstance().getTitleTypeface());
if (slide.getTitleSize() != null) {
title.setTextSize(COMPLEX_UNIT_DIP, slide.getTitleSize());
}
} else {
title.setVisibility(GONE);
title = null;
}
if (slide.getDescription() == null && slide.getOption() != null) {
ColorStateList buttonColors = ContextCompat.getColorStateList(getSafeContext(), android.R.color.white);
CheckBox option = (CheckBox) inflater.inflate(R.layout.introduction_fragment_option,
descriptionContainer, false);
option.setText(slide.getOption().getTitle());
option.setChecked(slide.getOption().isActivated());
option.setOnCheckedChangeListener((buttonView, isChecked) -> slide.getOption().setActivated(isChecked));
CompoundButtonCompat.setButtonTintList(option, buttonColors);
descriptionContainer.addView(option);
description = option;
} else if (slide.getDescription() != null) {
description = (TextView) inflater.inflate(R.layout.introduction_fragment_description,
descriptionContainer, false);
description.setText(slide.getDescription());
descriptionContainer.addView(description);
} else {
descriptionContainer.setVisibility(GONE);
}
if (description != null) {
description.setMaxLines(getLineCountForDescription());
description.setTypeface(IntroductionConfiguration.getInstance().getDescriptionTypeface());
if (slide.getDescriptionSize() != null) {
description.setTextSize(COMPLEX_UNIT_DIP, slide.getDescriptionSize());
}
}
if (slide.getImageResource() != null) {
image.setImageResource(slide.getImageResource());
}
IntroductionConfiguration.getInstance().callOnSlideInit(slide.getPosition(), title, image, description);
return root;
}