Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get tint color from ImageView via code

Tags:

android

How to get android:tint="" color from ImageView via code?

like image 659
Fabricio Avatar asked Nov 01 '16 18:11

Fabricio


People also ask

How can I change the color of an image in XML?

In XML is very easy to change tint color by just setting up the attribute android:tint="" in the ImageView tag, as shown in the following example.

How can I change the color of a picture?

Click the picture that you want to change. Under Picture Tools, on the Format tab, in the Adjust group, click Color. If you don't see the Format or Picture Tools tabs, make sure that you've selected a picture. You may have to double-click the picture to select it and open the Format tab.


1 Answers

To get the tint on all Android versions, use the ImageViewCompat:

int color = ImageViewCompat.getImageTintList(yourImageView).getDefaultColor();
like image 196
Rafael Chagas Avatar answered Sep 26 '22 08:09

Rafael Chagas