当前位置: 首页>>代码示例>>Java>>正文


Java CompoundButtonCompat.setButtonTintList方法代码示例

本文整理汇总了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();
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:21,代码来源:AppCompatCompoundButtonHelper.java

示例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();
  }
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:26,代码来源:AppCompatCompoundButtonHelper.java

示例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);
}
 
开发者ID:Loofer,项目名称:Watermark,代码行数:12,代码来源:MediaPageFragment.java

示例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));
}
 
开发者ID:Loofer,项目名称:Watermark,代码行数:13,代码来源:BucketAdapter.java

示例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));
}
 
开发者ID:Loofer,项目名称:Watermark,代码行数:13,代码来源:MediaGridAdapter.java

示例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()));
        }
    }
}
 
开发者ID:MCMrARM,项目名称:revolution-irc,代码行数:12,代码来源:ThemedCheckBox.java

示例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));
    }
}
 
开发者ID:ximsfei,项目名称:Android-skin-support,代码行数:12,代码来源:SkinCompatCompoundButtonHelper.java

示例8: setCheckedTint

import android.support.v4.widget.CompoundButtonCompat; //导入方法依赖的package包/类
public void setCheckedTint(@ColorInt int color) {
    CompoundButtonCompat.setButtonTintList(checkBox, ColorStateList.valueOf(color));
}
 
开发者ID:st1hy,项目名称:Red-Calorie,代码行数:4,代码来源:TagItemHolder.java

示例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;
}
 
开发者ID:rubengees,项目名称:introduction,代码行数:63,代码来源:IntroductionFragment.java


注:本文中的android.support.v4.widget.CompoundButtonCompat.setButtonTintList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。