InstaTag.java 文件源码

java
阅读 34 收藏 0 点赞 0 评论 0

项目:InstaTag 作者:
private void setColor(Drawable drawable, int color) {
    if (drawable instanceof ShapeDrawable) {
        ((ShapeDrawable) drawable).getPaint().setColor(color);
    } else if (drawable instanceof GradientDrawable) {
        ((GradientDrawable) drawable).setColor(color);
    } else if (drawable instanceof ColorDrawable) {
        ((ColorDrawable) drawable).setColor(color);
    } else if (drawable instanceof LayerDrawable) {
        LayerDrawable layerDrawable = (LayerDrawable) drawable;
        RotateDrawable rotateDrawable =
                (RotateDrawable) layerDrawable.findDrawableByLayerId(R.id.carrot_shape_top);
        setColor(rotateDrawable.getDrawable(), color);
    } else if (drawable instanceof RotateDrawable) {
        setColor(((RotateDrawable) drawable).getDrawable(), color);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号