I am developing for android. The app is designed in XML in Linear Layout. What I want to do is to leave some blank lines between the consecutive buttons/text to ensure some neatness in the GUI. Is it posible to do it in Linear Layout? Please help...
Asked
Active
Viewed 3,265 times
1
-
yes you should be able to use `android:layout_margin="10dp"` to add some space between elements. – FoamyGuy Oct 18 '13 at 14:36
2 Answers
5
You should use margins to seperate different components in your layout. An example of how this would look in your XML is: android:layout_marginTop="12dp"

Booger
- 18,579
- 7
- 55
- 72
2
If you want to leave space outside the border of text/button and next view elements you can use android:layout_marginLeft
, android:layout_marginRight
, android:layout_marginTop
and android:layout_marginBottom
.
If you want to leave space between border of the text/button and actual content of the text/button you can use android:paddingLeft
, android:paddingRight
, android:paddingTop
and android:paddingBottom
.
For more info check out this question how to increase the space between the elements in linearlayout in android?

Community
- 1
- 1

Abhishek V
- 12,488
- 6
- 51
- 63
-
1Padding is really not as good as margin. Padding is defined to add space to the INSIDE of your View. Where Margin is defined to add space to the OUTSIDE of your View (and is thus better for defining spacing between views). Padding = inside vs Margin = outside – Booger Oct 18 '13 at 20:54
-
-
Cheers, this is what SO is all about (learning!). Plus one for making your answer better. – Booger Oct 19 '13 at 13:11