In CSS, one can set a different padding for top, right, bottom and left using the following, 1 line statement:
padding: 5px,10px,15px,5px;
I was wondering if there is a way to do the same while implementing a layout in Android XML. Currently, to achieve the same result (using dp instead of px), I do it this way:
android:paddingTop="5dp";
android:paddingRight="10dp";
android:paddingBottom="15dp";
android:paddingLeft="5dp";
So, is there a way to do the above in a single statement? For example:
android:padding="5dp,10dp,15dp,5dp";
Yes but you cannot do that in XML but you can do it in your java code
btn_submit.setPadding(5,10,7,8);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With