Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: Layout Files Margin/Padding Shortcuts

hi do you know if there is a shortcut way to setup your layout files, a bit like CSS. e.g. rather than

android:layout_marginTop="20dp"
android:layout_marginLeft="20dp"
android:layout_marginBottom="10dp"
android:layout_marginRight="5dp"

maybe like this?

android:layout_margin="20dp, 20dp, 10dp, 5dp"

the same would be for Padding/Radius etc...

like image 890
Purplemonkey Avatar asked Mar 21 '12 18:03

Purplemonkey


1 Answers

if you want to set same value for all side then you can use like this:

android:layout_margin="20dp"

if you have different value for all side then you have to set them in this way:

android:layout_marginTop="20dp"
android:layout_marginLeft="20dp"
android:layout_marginBottom="10dp"
android:layout_marginRight="5dp"

and the same thing for padding.

like image 97
Deepak Avatar answered Nov 13 '22 23:11

Deepak