How to change colors of a Drawable in Android?

前端 未结 21 2153
野性不改
野性不改 2020-11-22 13:50

I\'m working on an android application, and I have a drawable that I\'m loading up from a source image. On this image, I\'d like to convert all of the white pixels to a dif

21条回答
  •  忘掉有多难
    2020-11-22 14:30

    I also use ImageView for icons (in ListView or settings screen). But I think there is much simpler way to do that.

    Use tint to change the color overlay on your selected icon.

    In xml,

    android:tint="@color/accent"
    android:src="@drawable/ic_event" 
    

    works fine since it comes from AppCompat

提交回复
热议问题