Tuesday, March 11, 2014

How to add space between each controls( buttons, text box )..

There is simple way to add space between controls( buttons, text boxes..etc..) in an linear layout. Add the following attribute in the controls,

<Button
android:layout_width="280dp"
android:layout_height="40dp"
android:layout_marginTop="15dp"
/>

This will allow 15dp space above the button. Likewise you can give space between each controls. You can use the following attributes too,

android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"