Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to increase the space between the elements in linearlayout in android? [duplicate]

In my application, I had Used linearlayout, inside that I am having 3 EditText elements. Now I want to increase the space(padding) between the Edittext element. Is it possible?

like image 723
Thiru Avatar asked Jan 17 '12 09:01

Thiru


People also ask

How can I add space between two views in android?

android:layout_marginTop XML attribute is used to specify extra space on the top side of this view. Thus android:layout_marginTop="10dp" on 2nd textView is specifying 10 dp of space between it and above view.

How do I change the space between buttons in android?

Notice the line that says android:layout_marginTop="10dip" which ensures that you leave a reasonable 10 dip space in between your buttons. Ofcourse, you can increase (or decrease) that space in between your buttons. That's your choice. Hope this answered your question satisfactorily.

Is it possible to evenly distribute buttons across the width of an android LinearLayout?

I suggest you use LinearLayout's weightSum attribute. Adding the tag android:weightSum="3" to your LinearLayout's xml declaration and then android:layout_weight="1" to your Buttons will result in the 3 buttons being evenly distributed.


1 Answers

Basically this is relative to your border, if you want to add the space between the elements inside the border (i.e. have the borders touching), you should use the padding property.

If you want to add the space outside the borders (have the borders apart) you should use the margin property.

Check this picture for illustration:

enter image description here

like image 162
MahdeTo Avatar answered Sep 30 '22 22:09

MahdeTo