Is it possible to change material design icon color from xml in Android?

前端 未结 9 1062
囚心锁ツ
囚心锁ツ 2020-12-05 06:39

I\'m actually trying to use colored icons in my app. I\'ve downloaded the official material design icon pack from here. Now all the icons in this pack are either white, grey

9条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-05 07:22

    Adding to what Murali said, make multiple drawables with different fill colors.

    Then when needed, add to your code:

    imageView.setImageResource(R.drawable.drawable_with_different_color)
    

    NOT: imageView.setBackgroundResource()

提交回复
热议问题