Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XML based graphics versus png drawables?

My partner, the designer, and I, the developer, are currently trying to figure out what is the best approach for performance and quality of an application across devices.

There are many cases where we can create the actual graphics such as button states and layout backgrounds, to name a couple, all based on xml. Some are complex and have a few layers and gradients, while others are simple shaped graphics.

At what point would it be recommended to have actual image drawables?

I'm thinking that the benefits of xml based graphics are higher quality and can be stretched and placed with flexibility across devices while actual image drawables need to be properly sized according for every screen densities or use nine-patch.

Could there be a performance penalty trying to create these xml drawables?

like image 557
Jona Avatar asked Dec 19 '11 00:12

Jona


1 Answers

Premature optimization is the root of evil.

Also good suggestions are here: Performance wise, what is typically better, using an image or a xml created shape as a drawable? and here Android Drawable Drawing Performance?

like image 150
woodshy Avatar answered Sep 30 '22 19:09

woodshy