Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VectorDrawable in ImageView #42

Open
ishaansrm opened this issue Aug 2, 2017 · 3 comments
Open

VectorDrawable in ImageView #42

ishaansrm opened this issue Aug 2, 2017 · 3 comments

Comments

@ishaansrm
Copy link

in ImageView we can normally set app:srcCompat="@drawable/ic_whatever" to set a vectorDrawable, instead of PNGs.

Can we have this support in the lib?

@ishaansrm
Copy link
Author

Since internally the lib is using .setImageResource() vector drawable should work, but it isn't on Kitkat and below.

@ishaansrm
Copy link
Author

Enabling the flag via AppCompatDelegate.setCompatVectorFromResourcesEnabled(true); makes the vectors work on <=4.4 but this opt-in feature causes memory issues

@ishaansrm
Copy link
Author

UPDATE: So this is what I think is happening. setImageResource() works on pre-lollipop because Studio generates PNGs for you. Since these resources are used at runtime, Studio maybe doesnt generate PNGs for them.

I got vectors to work by referencing the ImageView the same way you do for clickable views and then setting the imageView src programatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant