I have a fragment with a spinner in a layout. The spinner xml is:
<Spinner
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/spCategory"
android:spinnerMode="dialog"
android:dropDownWidth="match_parent"
android:prompt="@string/label_category_select" />
Populating the spinner is done like this:
List<Category> categories = categoryRepository.getAll();
CategoryAdapter adapter = new CategoryAdapter(this.getActivity(), categories);
adapter.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line);
spCategory= (Spinner)view.findViewById(R.id.spCategory);
spCategory.setAdapter(adapter);
CategoryAdapter
extends ArrayAdapter and I use ViewHolder pattern. The adapter uses this custom layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/tvSpinnerRowId"
android:visibility="gone">
</TextView>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/tvSpinnerRowName">
</TextView>
</RelativeLayout>
The problem is that the spinner height in the layout extends to the bottom of the screen.
What am I missing?