Android's bottom navigation bar overlaps the Spinner. Spinner Dropdown Height
There is an interesting problem I stumbled upon while working on an Android Honeycomb project. As you can see in the image below, when extending the Spinner in the dialog box, the navigation bar at the bottom overlaps it. Thus, the item at the bottom cannot be selected.
To fix this, I tried using the android:fitsSystemWindows="true"
Spinner in the widget. This does not work. Also I noticed that we have an XML attribute for the width of the dropdown android:dropDownWidth
, but not for the height.
Here is the XMl layout for 3 Spinners:
<TableRow>
<Spinner
android:id="@+id/order_dialog_category_code_Spinner"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:fitsSystemWindows="true" />
<Spinner
android:id="@+id/order_dialog_packing_code_Spinner"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:fitsSystemWindows="true" />
<Spinner
android:id="@+id/order_dialog_product_Spinner"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:fitsSystemWindows="true" />
</TableRow>
I will continue testing and hope to find a solution soon, but this is an interesting question and deserves to be posted.
I haven't tested on Android ICS yet, but I think it might act the same.
EDIT
I managed to fix the error using the attribute android:layout_marginBottom
for Spinners. It solved the problem, but now I have a field in the dialog and I don't want that.
Does anyone know how to set margin for the dropdown resource only?
source to share
After a bit of research, it seems that you cannot manipulate the height of the Spinner dropdown or any other attributes of the layout.
This is because the dropdown is a popup dialog that cannot be accessed from the Spinner view.
This answer says: https://stackoverflow.com/a/1918655/529138
So this means that I have to use android:layout_marginBottom
as stated in the question.
source to share
Even I faced the same problem. Unlike a screen, my screen only has one option. so I made the fix by changing android: spinnerMode: "dialog".
<Spinner
android:id="@+id/dialog_spinner"
android:spinnerMode="dialog"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
This will display your list in a new dialog box. Might be helpful for people looking for a similar problem just in case.
source to share