android.widget.TextView.drawableStateChanged()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(1.7k)|赞(0)|评价(0)|浏览(112)

本文整理了Java中android.widget.TextView.drawableStateChanged()方法的一些代码示例,展示了TextView.drawableStateChanged()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TextView.drawableStateChanged()方法的具体详情如下:
包路径:android.widget.TextView
类名称:TextView
方法名:drawableStateChanged

TextView.drawableStateChanged介绍

暂无

代码示例

代码示例来源:origin: aa112901/remusic

@Override
protected void drawableStateChanged() {
  super.drawableStateChanged();
  if (getBackground() != null) {
    invalidateDrawable(getBackground());
  }
}

代码示例来源:origin: ZieIony/Carbon

@Override
protected void drawableStateChanged() {
  super.drawableStateChanged();
  if (rippleDrawable != null && rippleDrawable.getStyle() != RippleDrawable.Style.Background)
    rippleDrawable.setState(getDrawableState());
  if (stateAnimator != null)
    stateAnimator.setState(getDrawableState());
  ColorStateList textColors = getTextColors();
  if (textColors instanceof AnimatedColorStateList)
    ((AnimatedColorStateList) textColors).setState(getDrawableState());
  if (tint != null && tint instanceof AnimatedColorStateList)
    ((AnimatedColorStateList) tint).setState(getDrawableState());
  if (backgroundTint != null && backgroundTint instanceof AnimatedColorStateList)
    ((AnimatedColorStateList) backgroundTint).setState(getDrawableState());
  if (ambientShadow != null && ambientShadowColor != null)
    ambientShadowColorFilter = new PorterDuffColorFilter(ambientShadowColor.getColorForState(getDrawableState(), ambientShadowColor.getDefaultColor()), PorterDuff.Mode.MULTIPLY);
  if (spotShadow != null && spotShadowColor != null)
    spotShadowColorFilter = new PorterDuffColorFilter(spotShadowColor.getColorForState(getDrawableState(), spotShadowColor.getDefaultColor()), PorterDuff.Mode.MULTIPLY);
}

相关文章

微信公众号

最新文章

更多

TextView类方法