I am using appcompat v21 in a project, but I do not like the new spinner it comes with by default. This new spinner comes only with a small downward-facing arrow that indicates it presence. I would prefer the old spinner used in 4.x versions of android which come with an EditText-like feature underlining the widget's content and an arrow in the bottom right corner.
How can I achieve this spinner style while still using appcompat v21?
The udesired spinner style:
photo of undesired spinner:
photo of desired spinner:
<Spinner
android:id="@+id/spinner_nav"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:spinnerMode="dropdown"
android:overlapAnchor="false"
style="@style/Platform.Widget.AppCompat.Spinner"/>
You can simply set the Style of the Spinner to Widget.Holo.Light.Spinner
<Spinner
android:id="@+id/spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@android:style/Widget.Holo.Light.Spinner" />
This will give you the old Spinner-Style back though there are two drawbacks:
Spinner
. Starting with Lollipop it'll be above the Spinner (afaik there's no way to change this). With regard to this see the following comparison (on the left pre Lollipop)If you wish to customize the rows of the DropDown you can do so by calling setDropDownViewResource(int) on the adapter of the Spinner with the reference to your own layout.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With