Android: How to change size of vector drawable image


Android 5.0 brought support for vector drawables similar to SVG. The lack of backwards compatibility with older versions of Android has probably seen a slow uptake in using it, but the recent addition of vector assets to Android Studio helps to conquer that hurdle illustrates the belief Google have in the merits of wide adoption of vector graphics by Android apps.

It should be noted that the Lollipop support for vector drawables had some kinks which have been ironed out in later Android releases. Most notably in Lolipop scaled vector drawables appear aliased.
from api v23 (Marshmallow) they scale just fine.

So if you do manage to end up in a situation where you want to scale a vector drawable (i.e. your app is only supporting v23+) then the following example (where the icon is by default 24 x 24) is one way to do it.

<ImageView    android:id="@+id/icon"    android:layout_width="240dp"    android:layout_height="240dp"    android:layout_alignParentLeft="true"    android:src="@drawable/my_test_vector"    />

VectorDrawable vectorDrawable = (VectorDrawable) mIconImageView.getDrawable();
vectorDrawable.setTint(Color.WHITE);
vectorDrawable.setBounds(0,0,mIconImageView.getWidth(),mIconImageView.getHeight());

Comments

  1. It is very useful to know about how to change the size of vector. thank you for sharing the blog with us.
    JAVA TRAINING

    ReplyDelete
  2. Thanks a lot for all your valuable article! We are really happy about the your...
    hadoop Training in Chennai

    ReplyDelete
    Replies
    1. I have read your blog its very attractive and impressive. I like it your blog.

      Java Training in Chennai Core Java Training in Chennai Core Java Training in Chennai

      Java Online Training Java Online Training JavaEE Training in Chennai Java EE Training in Chennai

      Delete
  3. These information really worth saying, i think you are master of the content and thank you so much sharing that valuable information and get new skills after refer that post.
    informatica

    ReplyDelete
  4. Awesome..You have clearly explained ...Its very useful for me to know about new things..Keep on blogging..
    Java Training in Chennai

    ReplyDelete
  5. You have clearly explained about How to change size of vector drawable image..Its very useful and informative..Keep on sharing..
    Java Training in Chennai

    ReplyDelete
  6. It looks like you spend a lot of effort and time on your blog. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work


    SEO Training in Chennai

    ReplyDelete
  7. I really very nice articles and great effort contents of blog.I clearly watch the android apps its amazing apps. Its useful for you.


    Java training in Chennai

    ReplyDelete
  8. Thank you for sharing the information here. Its much informative and really i got some valid information. You had posted the amazing article.

    Dotnet Training in Chennai

    ReplyDelete
  9. this content is really useful and you have done a tremendous work ,it is really awesome and it is good too.


    php Training in Chennai

    ReplyDelete
  10. In the site was very excellent,i think this is very best one compare others and then the more information to get after read this post.

    hadoop

    ReplyDelete
  11. I have been following you for a couple of months now but this is my first time commenting on a blog post. Thank you for sharing your knowledge and experience with us. Keep up the good work. Already bookmarked for future reference.

    SAP training in Chennai

    ReplyDelete
  12. Everything is fine, am happy about your blog. Thanks admin for sharing the unique content, you have done a great job I appreciate your effort and I hope you will get more positive comments from the web users.


    SAP training in Chennai

    ReplyDelete
  13. Great and useful article. Creating content regularly is very tough. Your points are motivated me to move on.


    SEO Company in Chennai

    ReplyDelete
  14. Really nice information you had posted. Its very informative and definitely it will be useful for many people

    Email Marketing Chennai

    ReplyDelete
  15. Useful post.You have told another data which is useful and i assembled learning about this subject so please overhaul data more upgrade this theme.
    Regards,
    Informatica Training Institute in Chennai | Informatica Training center Chennai

    ReplyDelete
  16. Thank you for taking time to provide us some of the useful and exclusive information with us.
    Regards,
    dotnet courses in Chennai | .net training Chennai | .net course in Chennai

    ReplyDelete
  17. This comment has been removed by the author.

    ReplyDelete
  18. Pretty article! I found some useful information in your blog, it was awesome to read, thanks for sharing this great content to my vision, keep sharing.
    Regards,

    Core JAVA Training in Chennai | JAVA Training in Chennai

    ReplyDelete
  19. Pretty article! I found some useful information in your blog, it was awesome to read, thanks for sharing this great content to my vision, keep sharing.
    Regards,

    PHP Training in Chennai | Webdesigning Training in Chennai

    ReplyDelete

  20. Thanks for splitting your comprehension with us. It’s really useful to me & I hope it helps the people who in need of this vital information.
    Regards,'
    Performance Tuning Training in Chennai | Oracle PL/SQL Training in Chennai

    ReplyDelete
  21. Nice content with valuable information. Thanks for sharing.
    Java Training institute in Velachery

    ReplyDelete
  22. Thanks Admin for sharing such a useful post, I hope it’s useful to many individuals for whose looking this precious information to developing their skill.
    Regards,
    Best DOT NET Training in Chennai|DOT NET Training in Chennai|DOT NET Course in Chennai

    ReplyDelete
  23. Very useful information in this article! its really useful for Java development company, but we request new updated article as ASP.NET reached one notch up

    ReplyDelete
  24. You have provided an nice article, Thank you very much for this one. And i hope this will be useful for many people.. and i am waiting for your next post keep on updating these kinds of knowledgeable things...

    iOS Training in Chennai
    Android Training in Chennai
    php Training in Chennai

    ReplyDelete
  25. Thanks for your informative article. As the demand quality apps and games increases in the mobile market, there is huge demand for the android developers in the job market
    Hi we at Colan Infotech Private Limited , a company which is Situated in US and India, will provide you best java web service and our talented java application development team will assure you best result and we are familiar with international markets, We work with customers in a wide variety of sectors. Our talented team can handle all the aspects of Java web application development, we are the best among the
    Java development company
    .

    We have quite an extensive experience working with java development services. we are the only Java application development company which offer custom services to a wide range of industries by exceeding our client’s expectations. You can even interact directly with the team regarding your project, just as you would with your in-house team.Our pro team will provide you the best java appliaction development services. We are best among the java development companies in Chennai, please review our customer feedbacks so that you may find a clue about us. If you want one stop solution for java development outsourcing, Colan infotech is the only stop you need to step in. Colan Infotech is the unique java web development company were our team of unique java application developer were ranked top in java enterprise application development.

    ReplyDelete
  26. Thanks for your informative article. As the demand quality apps and games increases in the mobile market, there is huge demand for the android developers in the job market
    Hi we at Colan Infotech Private Limited , a company which is Situated in US and India, will provide you best java web service and our talented java application development team will assure you best result and we are familiar with international markets, We work with customers in a wide variety of sectors. Our talented team can handle all the aspects of Java web application development, we are the best among the
    Java development company
    .

    We have quite an extensive experience working with java development services. we are the only Java application development company which offer custom services to a wide range of industries by exceeding our client’s expectations. You can even interact directly with the team regarding your project, just as you would with your in-house team.Our pro team will provide you the best java appliaction development services. We are best among the java development companies in Chennai, please review our customer feedbacks so that you may find a clue about us. If you want one stop solution for java development outsourcing, Colan infotech is the only stop you need to step in. Colan Infotech is the unique java web development company were our team of unique java application developer were ranked top in java enterprise application development.

    ReplyDelete
  27. Very Nice Blog I like the way you explained these things. I’ve been looking for ways to improve my website and overall rankings.I hope your future article will help me further.Take SEO Training in Chennai to mould yourself.

    ReplyDelete
  28. It’s really amazing that we can record what our visitors do on our site. Thanks for sharing this awesome guide. I’m happy that I came across with your site this article is on point,thanks again and have a great day. Keep update more information..

    Mobile App Development Company in India

    ReplyDelete

  29. This is excellent information. It is amazing and wonderful to visit your site.Thanks for sharing this information,this is useful to me...
    Android Training in Chennai
    Ios Training in Chennai

    ReplyDelete

  30. I wondered upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I’ll be subscribing to your

    feed and I hope you post again soon.

    Android App Development Company

    ReplyDelete
  31. This comment has been removed by the author.

    ReplyDelete
  32. This comment has been removed by the author.

    ReplyDelete
  33. These ways are very simple and very much useful, as a beginner level these helped me a lot thanks fore sharing these kinds of useful and knowledgeable information.
    iOS App Development Company
    iOS App Development Company

    ReplyDelete
  34. I am expecting more interesting topics from you. And this was nice content and definitely it will be useful for many people.
    Fitness SMS
    Fitness Text
    Salon SMS
    Salon Text
    Investor Relation SMS
    Investor Relation Text

    ReplyDelete
  35. great and nice blog thanks sharing..I just want to say that all the information you have given here is awesome...Thank you very much for this one.
    web design Company
    web development Company
    web design Company in chennai
    web development Company in chennai
    web design Company in India
    web development Company in India

    ReplyDelete
  36. it is really amazing...thanks for sharing....provide more useful information...
    Mobile app development company

    ReplyDelete
  37. Good and nice blog post, thanks for sharing your information.. it is very useful to me.. keep rocks and updating



    Java Training in chennai

    ReplyDelete
  38. affordable dumpsters virginia Thanks for sharing the article. Keep updating more with us.

    ReplyDelete
  39. Needed to compose you a very little word to thank you yet again regarding the nice suggestions you’ve contributed here.

    Java Training in Bangalore

    ReplyDelete
  40. Thanks for your marvelous posting! It is very useful and good. Come on. I want to introduce the best aso services for you, I try it and I feel it is so good to rank app to top in app store search results, have you ever heard it?

    ReplyDelete
  41. Really it was an awesome article...very interesting to read..You have provided an nice article....Thanks for sharing..
    Android Training in Chennai
    Ios Training in Chennai

    ReplyDelete

Post a Comment

Popular posts from this blog

AngularJs: User friendly date display with AngularJs and MomentJs

Nerd Tree: A File Explorer with Mac Vim

Getting started with Grails functional tests using Geb + Spock