Modifying the color of an android drawable

后端 未结 6 1067
一生所求
一生所求 2020-11-30 17:30

I would like to be able to use the same drawable to represent both:

\"Blue and

6条回答
  •  猫巷女王i
    2020-11-30 18:28

    Your answer is very nice. Although, this solution is practice too if you're using a Textview and a embed drawable:

    int colorARGB = R.color.your_color;
    Drawable[] textviewDrawables = drawerItem.getCompoundDrawables();
    // Left Drawable
    textviewDrawables[0].setColorFilter(colorARGB, PorterDuff.Mode.SRC_ATOP);
    

提交回复
热议问题