Check Mobile App
Read now
Start a Project

Creating TextViews with Drawable and supporting vector images in it


As we know this is the age of vector for android. But there is some constraints even in the latest support libraries. One such is setting vector image for the drawable associated with the text view.


In order to add vector drawable images/icons in the drawable of a text view. We can use the following workaround. Until Android guys don’t come up with the updated libraries.

The idea is of adding vector image inside a layer-list or selector drawable and then setting it directly.


Here is the example:

/* ic_wishlist_wrapper.xml */

/* ic_wishlist.xml */

and now setting ic_wishlist_wrapper instead of ic_wishlist will do the trick.


Hope this trick works for you and you continue to support more and more VectorDrawables.


. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


  • Bukenya Charles Lusansa
    Didn’t work for me
  • css.php

    When I think in getting solutions for my Ecommerce Platform, I think of Webkul. They have been such a blessing in our business. We have spent thousands of dollars in support and modules from them. We love their support team. They work very closely with us, and they always go the extra mile when we need help.

    Michael Urresta

    Michael Urresta

    Talk to Sales


    Live Chat
    Start a Project

      Message Sent!

      If you have more details or questions, you can reply to the received confirmation email.

      Back to Home