I have a LinearLayout with four children. Each children is a linear layout with an ImageView and a TextView (centered below ImageView). It happens that a TextView is a bit bigger than the others so it takes more space, than the others which causes trouble cause I need them all to have exact the same size (because I have another LinearLayout below the one I'm talking right now and I all the children be aligned). This strikes me weird because I've already set
android:layout_weight="1"
which I thought makes the children in a LinearLayout occupy the same space. Here is my code, for better understanding:
<LinearLayout
android:id="@+id/line_1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/line_2"
android:layout_marginBottom="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:baselineAligned="false"
android:gravity="center_vertical" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1"
android:background="#FFFFFF"
android:gravity="center_horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="50dp"
android:src="@drawable/sights_selector" />
<TextView
android:id="@+id/corfu_textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Sights"
android:textSize="10sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1"
android:background="#FFFFFF"
android:gravity="center_horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="50dp"
android:src="@drawable/activities_selector" />
<TextView
android:id="@+id/epirus_textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Activities"
android:textSize="10sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:layout_weight="1"
android:background="#FFFFFF"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="50dp"
android:src="@drawable/accomodation_selector" />
<TextView
android:id="@+id/vlora_textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Accomodation"
android:textSize="10sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:layout_weight="1"
android:background="#FFFFFF"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="50dp"
android:src="@drawable/villages_selector" />
<TextView
android:id="@+id/vlora_textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Villages"
android:textSize="10sp" />
</LinearLayout>
</LinearLayout>
No comments:
Post a Comment