android.graphics.drawable.Drawable.setTintList()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(4.6k)|赞(0)|评价(0)|浏览(253)

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

Drawable.setTintList介绍

暂无

代码示例

代码示例来源:origin: facebook/litho

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
public void setTintList(ColorStateList tint) {
 mDrawable.setTintList(tint);
}

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

@Override
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public void setTintList(ColorStateList tint) {
  final ChildDrawable[] array = mLayerState.mChildren;
  final int N = mLayerState.mNum;
  for (int i = 0; i < N; i++) {
    final Drawable dr = array[i].mDrawable;
    if (dr != null) {
      dr.setTintList(tint);
    }
  }
}

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

public static void setTintList(Drawable drawable, ColorStateList tint) {
  drawable.mutate();
  if (Carbon.IS_LOLLIPOP_OR_HIGHER) {
    drawable.setTintList(tint);
  } else if (drawable instanceof TintAwareDrawable) {
    ((TintAwareDrawable) drawable).setTintList(tint);
  } else {
    drawable.setColorFilter(tint == null ? null : new PorterDuffColorFilter(tint.getColorForState(drawable.getState(), tint.getDefaultColor()), PorterDuff.Mode.MULTIPLY));
  }
}

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

public static void setTintListMode(Drawable drawable, ColorStateList tint, PorterDuff.Mode mode) {
  drawable.mutate();
  if (Carbon.IS_LOLLIPOP_OR_HIGHER) {
    drawable.setTintList(tint);
    drawable.setTintMode(mode);
  } else if (drawable instanceof TintAwareDrawable) {
    ((TintAwareDrawable) drawable).setTintList(tint);
    ((TintAwareDrawable) drawable).setTintMode(mode);
  } else {
    drawable.setColorFilter(tint == null ? null : new PorterDuffColorFilter(tint.getColorForState(drawable.getState(), tint.getDefaultColor()), mode));
  }
}

代码示例来源:origin: DreaminginCodeZH/MaterialProgressBar

logDrawableTintWarning();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
  drawable.setTintList(tint);

代码示例来源:origin: sjwall/MaterialTapTargetPrompt

mIconDrawable.setTintList(mIconDrawableTintList);

代码示例来源:origin: DreaminginCodeZH/MaterialRatingBar

logDrawableTintWarning();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
  drawable.setTintList(tintList);

代码示例来源:origin: AlexMofer/ProjectX

@Override
public void setTintList(ColorStateList tint) {
  if (mDrawable == null)
    return;
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
    mDrawable.setTintList(tint);
}

代码示例来源:origin: AlexMofer/ProjectX

@Override
public void setTintList(ColorStateList tint) {
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
    mDrawable.setTintList(tint);
}

代码示例来源:origin: kingargyle/adt-leanback-support

public static void setTintList(Drawable drawable, ColorStateList tint) {
  drawable.setTintList(tint);
}

代码示例来源:origin: MCMrARM/revolution-irc

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
public void setTintList(ColorStateList tint) {
  mDrawable.setTintList(tint);
}

代码示例来源:origin: WireGuard/wireguard-android

private void setDrawableTintList(@Nullable final ColorStateList tint) {
  mDrawable.setTintList(tint);
}

代码示例来源:origin: AlexMofer/ProjectX

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
public void setTintList(ColorStateList tint) {
  if (mItems.isEmpty()) {
    super.setTintList(tint);
    return;
  }
  for (ChildDrawable child : mItems) {
    child.getDrawable().setTintList(tint);
  }
}

代码示例来源:origin: AlexMofer/ProjectX

@Override
public void setTintList(ColorStateList tint) {
  super.setTintList(tint);
  if (mProgressDrawable == null)
    return;
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
    mProgressDrawable.setTintList(tint);
}

代码示例来源:origin: enricocid/LaunchEnr

public Drawable getIconForBackground(Context context, int background) {
  if (mIsIconLarge) {
    // Only small icons should be tinted.
    return mIconDrawable;
  }
  mIconColor = IconPalette.resolveContrastColor(context, mIconColor, background);
  Drawable icon = mIconDrawable.mutate();
  // DrawableContainer ignores the color filter if it's already set, so clear it first to
  // get it set and invalidated properly.
  icon.setTintList(null);
  icon.setTint(mIconColor);
  return icon;
}

代码示例来源:origin: WireGuard/wireguard-android

@Override
public void setTintList(@Nullable final ColorStateList tint) {
  super.setTintList(tint);
  setDrawableTintList(tint);
  mPaint.setColor(tint == null ? 0 : tint.getDefaultColor());
  invalidateSelf();
}

代码示例来源:origin: com.albedinsky.android/ui-widget-common

if (UiConfig.MATERIALIZED) {
  if (configuration.iconTintListSpecified) {
    icon.setTintList(configuration.iconTintList);

代码示例来源:origin: com.albedinsky.android/ui

if (UiConfig.MATERIALIZED) {
  if (configuration.iconTintListSpecified) {
    icon.setTintList(configuration.iconTintList);

代码示例来源:origin: com.albedinsky.android/ui

mDaySelector.mutate();
if (mTintInfo.hasTintList) {
  mDaySelector.setTintList(mTintInfo.tintList);

代码示例来源:origin: com.albedinsky.android/ui-widget-picker

mDaySelector.mutate();
if (mTintInfo.hasTintList) {
  mDaySelector.setTintList(mTintInfo.tintList);

相关文章