10

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

8
  • I think setImageTintList() is what you want : here Commented Nov 1, 2016 at 18:17
  • Oh sorry my mistake. Check this answer Commented Nov 1, 2016 at 18:18
  • @mt0s not to set, but to get Commented Nov 1, 2016 at 18:19
  • Right, I missed the get. Then getColorFilter() should work for you Commented Nov 1, 2016 at 18:21
  • @mt0s I don't know how to get the color from ColorFilter object. Commented Nov 1, 2016 at 18:22

1 Answer 1

9

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

int color = ImageViewCompat.getImageTintList(yourImageView).getDefaultColor();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.