private void setColors(View view, int[] colors) {
Drawable drawable = view.getBackground();
if (drawable instanceof StateListDrawable) {
StateListDrawable stateListDrawable = (StateListDrawable) drawable;
DrawableContainerState drawableContainerState = (DrawableContainerState) stateListDrawable.getConstantState();
if (drawableContainerState != null) {
Drawable[] drawables = drawableContainerState.getChildren();
for (int i = 0; i < colors.length; i++) if (drawables[i] instanceof GradientDrawable) ((GradientDrawable) drawables[i]).setColor(colors[i]);
}
} else Log.w(TAG, "Drawable of view must be StateListDrawable in WoWoStateListColorAnimation");
}
WoWoStateListColorAnimation.java 文件源码
java
阅读 25
收藏 0
点赞 0
评论 0
项目:GitHub
作者:
评论列表
文章目录