I have an application that has several buttons, for this I use different available images (png) to set the background.
I know that you can draw custom buttons in android using the "drawable xml" files. In them you can define shapes and set gradients, indents, etc. For this particular form. This reduces the size of the application (since using it eliminates all PNGs).
background.xml
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <gradient android:startColor="#FFFF0000" android:endColor="#FFFFFFFF" android:angle="90" /> <padding android:left="4dp" android:top="4dp" android:right="4dp" android:bottom="4dp" /> <corners android:radius="4dp" />
My question is, which is more preferable, from a memory point? What are the main advantages / disadvantages of one of them?
source share