Recent Posts

Site Creator

By

By

By

Using Shapedrawables for Light UI

Posted on

Normal drawable images like .jpeg,.png etc when used to make stunning Android UI makes UI heavier. Thus increases loading time for the activity. Also doing this increases application size. To remedy this , android OS provides Shape Drawable those can be used. Shape Drawable are created using xml.

 

For eg a shape drawable is created and then stored in drawable/ folder of Android application.

Now this shape drawable can be used as per need. For eg for background of a linear layout.

The best part of shape drawable is that orientation changes, config changes etc that can impact a shape drawable is automatically handled by android os. In addition to this if you are planning to develop app that targets devices having different resolutions you don’t have to provide different set of drawables to all of the drawables. Thus it won’t increase size of your application. This will keep your UI Light.

 

[Edited]  Also you during development of android application you need to build UI that modifies itself when the application targets different screen densities , screen dimensions phones.  At that time if one thinks to provide different images for different devices, this will result in an application having a very large size and bring an array of other problems which are out of scope of this blog.

 

Last but not the least

A working code example for the post is available at  ShapeDrawableDemo

 

Happy Coding !.

 

 

 







Disclaimer: The aforesaid writeup by Relsell Global writer is for the general understanding of the readers. It does not render any professional advice or opinion.

SHARE THIS PAGE!