I'm trying to style a TextView
like a spinner in my app, so that it looks like a spinner but does allow me to easily show a custom dialog for editing the value.
I use the following in my layout XML:
<TextView
style="?android/spinnerStyle"
...
/>
All works as expected on an Android 5 emulator. My TextView
and other Spinner
s look alike. They display a litte down-arrow on the right:
However, when I run the same code on an Android 4.4 emulator, the Spinner
s still look like above (because I'm using the Support Library in the most recent version), but the TextView
looks like an Android 4.4 spinner:
This results in an inconsistent look in my Activity. I notice that Spinner
is one of the controls the style of which is handled by the support library for Android versions older than 5.
The question I have is: Is there a way to tell the TextView
to use the AppCompat spinner style as well? If so, how can I do this?
Seems I accidentially found the styles myself. The following provides the layout as desired:
<TextView
style="@style/Base.Widget.AppCompat.Spinner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.AppCompat.Widget.TextView.SpinnerItem"
android:paddingStart="8dp"
android:paddingEnd="8dp"
/>