When I use the ScrollView some of the columns got fit.
Example:
DNI column should be a little wider. The reason of using scrollview is because I will add more columns. I tried to change "match_parent" and some trick from other post of StackOverflow, but I don't get any successful result.
I refactored the code in order to avoid nested weight and use "0dp":
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.privacity.PermisosActivity"
tools:ignore="MergeRootFrame" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/gray"
android:orientation="vertical"
android:weightSum="1" >
<HorizontalScrollView
android:id="@+id/horizontalScrollView1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.5" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal"
android:baselineAligned="false"
android:weightSum="2" >
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignTop="true" >
<CheckBox
android:id="@+id/chkNombre"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/textView3"
android:layout_alignTop="true"
android:layout_gravity="center"
android:background="@xml/nombre_checkbox"
android:button="@null" />
<TextView
android:id="@+id/textView3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_gravity="center"
android:text="@string/nombre"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="15sp" />
</RelativeLayout>
<!-- ANOTHER RelativeLayout -->
</RelativeLayout>
<!-- FIN DE COLUMNA -->
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignTop="true" >
<CheckBox
android:id="@+id/chkDNI"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/textView4"
android:layout_alignTop="true"
android:background="@xml/dni_checkbox"
android:button="@null" />
<TextView
android:id="@+id/textView4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:gravity="center"
android:text="@string/nombre"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="15sp" />
</RelativeLayout>
<!-- ANOTHER RelativeLayout -->
</RelativeLayout>
<!-- FIN COLUMNA -->
</LinearLayout>
</HorizontalScrollView>
<Button
android:id="@+id/AceptarPerfil"
style="@style/btnStyleGreen"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"
android:layout_weight="0.5"
android:onClick="validar"
android:text="@string/validar" />
</LinearLayout>
</FrameLayout>
If I change the text (Nombre instead of DNI), the widths are the same, so something wrong happens with my textview or their parents.
I would like to know why this happens.