Reputation: 628
I have a problem with layout file, when i test it on devices with Android 4.1, why does it happens I don't know, so here's what i get:
And here's the part of layout where it happens:
<LinearLayout
android:id="@+id/chooseType"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="visible"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginRight="16dp"
android:layout_marginEnd="16dp"
android:layout_marginTop="12dp"
android:orientation="horizontal">
<CheckBox
android:id="@+id/checkbox1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:button="@drawable/custom_checkbox" />
<CheckBox
android:id="@+id/checkbox2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:button="@drawable/custom_checkbox2" />
<CheckBox
android:id="@+id/checkbox3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:button="@drawable/custom_checkbox3" />
<CheckBox
android:id="@+id/checkboxHomes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:button="@drawable/custom_checkboxhouses" />
<CheckBox
android:id="@+id/checkboxRooms"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:button="@drawable/custom_checkboxrooms" />
</LinearLayout>
I've tried to remove layout weight but it seems that somehow LinearLayout ignores it and tries to crop the last element in layout.
Upvotes: 0
Views: 195
Reputation: 2487
First, if you use LinearLayout
's weights, children which you set weight should have
android:layout_width="0dp"
(or android:layout_width
when LinearLayout
's orientation is vertical).
Here you have an explanation.
Second case is that you did not set weight to last of checkboxes :)
Upvotes: 2