i\'ve an activity that contains a LinearLayout (horizontal), i want that all elements inside the LinearLyout are attached, without margin or padding. I\'ve tried many methods bu
Always use RelativeLayouts. Not use Linear inside relative. The best practices in android:
http://android-developers.blogspot.com/2009/02/android-layout-tricks-1.html
Use for example commands like:
layout_above
layout_toRightOf
layout_alignParentTop
etc.
In values/dimens.xml file you can set margins.
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">0dp</dimen>
<dimen name="activity_vertical_margin">0dp</dimen>
You can use android:layout_weight property in LinearLayout,this will override all th padding,
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="3">
<TextView
.
.
.
android:layout_weight="1" />
<TextView
.
.
.
android:layout_weight="1" />
<TextView
.
.
.
android:layout_weight="1" />
</LinearLayout>
Look in your RelativeLayout parent container and instead of:
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
put dimension to 0dp:
android:paddingRight="0dp"
android:paddingTop="0dp"
android:paddingBottom="0dp"