I'm trying to put a line dividing the items I have into Spinner
but I can not seem to get it.
spinner_item.xml
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
style="@style/spinnerItemStyle"
android:maxLines="1"
android:textColor="@color/grey_default"
android:textStyle="bold"
android:textSize="12dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="marquee" />
spinner_dropbox.xml
<?xml version="1.0" encoding="utf-8"?>
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
style="@style/spinnerDropDownItemStyle"
android:maxLines="1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee" />
styles.xml
<style name="spinnerItemStyle" parent="android:Widget.TextView.SpinnerItem"/>
<style name="spinnerDropDownItemStyle" parent="Widget.AppCompat.ListView.DropDown">
<item name="android:dividerHeight">2dip</item>
<item name="android:divider">#808080</item>
</style>
MainActivity (...)
//adapter creation categorias
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.spinner_item, list_categorias);
adapter.setDropDownViewResource(R.layout.spinner_dropbox);
categoria.setAdapter(adapter);
What I'm getting is this:
Can anyone help? Why not draw the line between the various items?