Reputation: 17878
I use following Layout with weights and in the preview and on my Android 4 mobile everything works fine.
Now on my Android 2.3.4 mobile, instead of seeing 3 buttons and a spinner, I only see exactly 1 and a half button, the rest is not on the screen anymore...
If I change the last weight to 1, so that all views have a layout_weight
of 1, it works on the old phone as well.
What do I do wrong?
Here is my code:
<com.actionbarsherlock.internal.widget.IcsLinearLayout
android:id="@+id/illBottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true" >
<ImageButton
android:id="@+id/btSelectAll"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/abs__item_background_holo_dark"
android:gravity="center"
android:onClick="onClick"
android:padding="4dip"
android:src="@drawable/holo_dark_content_select_all" />
<ImageButton
android:id="@+id/btDeselectAll"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/abs__item_background_holo_dark"
android:gravity="center"
android:onClick="onClick"
android:padding="4dip"
android:src="@drawable/holo_dark_custom_content_deselect_all" />
<ImageButton
android:id="@+id/btDeleteSelected"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/abs__item_background_holo_dark"
android:gravity="center"
android:onClick="onClick"
android:padding="4dip"
android:src="@drawable/holo_dark_content_discard" />
<Spinner
android:id="@+id/spData"
style="@style/Widget.Sherlock.Spinner.DropDown.ActionBar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2" />
</com.actionbarsherlock.internal.widget.IcsLinearLayout>
Upvotes: 1
Views: 313
Reputation: 21
Most likely you need to add a linear layout over the whole thing or use your already made com.... And put android:layout_weightSum="3 or whatever"
Put this into whatever element holds your image buttons.
Upvotes: 1