Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between using vector drawable and a set of .png for icons in Android?

What are the pros and cons in using vector drawables vs. using a set of .png for Android system icons?

If they're meant for two different things, what are those?

like image 524
Vicky Leong Avatar asked Aug 05 '16 18:08

Vicky Leong


1 Answers

A png is a compressed image. It has a fixed size, if you try to make it bigger or smaller it will need to either duplicate or remove data. Too big or too small and it doesn't look right (too big is worse than too small).

A vector drawable is a series of commands that tell it how to draw something. These commands scale, so a well executed vector drawable will look as good at 1000x1000 as it does at 100x100.

The advantage of a png is its easy to do and relatively fast performance. A vector drawable is slower (you have to execute the commands) and harder to create a good one. But it scales better. If scaling isn't needed, a png is probably what you want. If it is, you may want a vector.

Also note some kinds of images work better for vectors than others- an icon is a good use of a vector. A photograph wouldn't work.

like image 69
Gabe Sechan Avatar answered Oct 03 '22 02:10

Gabe Sechan