I tried to make Spinner
with white text as my theme but when Spinner
popup show then it has default white background so my text isn't visible there. I also tried to set with both android:popupBackground
and app:popupBackground
but it doesn't reflect there.
Screenshots of Spinner
:
Spinner 1
Spinner Popup 2
<android.support.v7.widget.AppCompatSpinner
android:id="@+id/spinLocation"
style="@style/Base.Widget.AppCompat.Spinner.Underlined"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:popupBackground=""
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="20dp"
app:backgroundTint="@color/white" />
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/txtValue"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:maxLines="1"
android:paddingBottom="7dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="7dp"
android:text=""
android:textColor="@color/white"
android:textSize="@dimen/_12sdp" />
I know it is because of item textColor
but if I do not define it then it showing in popup but not proper in Spinner
. So suggest me a best approach for this and also suggest for header if appCompatSpinner
supports it. Thanks.
You need to set themes, or create a custom one.
Here is a sample code:
<android.support.v7.widget.AppCompatSpinner
style="@style/Base.Widget.AppCompat.Spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:entries="@array/array_radius"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:theme="@style/ThemeOverlay.AppCompat.Light" />
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