Android Toolbar with Spinner with white text and white popup background? -


i've been trying add spinner toolbar failed achieve want.

this have far.

enter image description here enter image description here

as can see on screen shots, spinner's selected text color black (i want white) while popup has white background text color black (this ok).

here's code.

       <android.support.v7.widget.toolbar         android:id="@+id/bottom_toolbar"         android:layout_width="match_parent"         android:layout_height="?attr/actionbarsize"         android:background="?attr/colorprimary"         app:popuptheme="@style/themeoverlay.appcompat.light"         android:layout_alignparentbottom="true">          <linearlayout             android:layout_width="match_parent"             android:layout_height="wrap_content"             android:orientation="horizontal">              <imagebutton                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:background="@drawable/ic_date_range_white_24dp" />              <android.support.v7.widget.appcompatspinner                 android:id="@+id/date_range"                 android:layout_width="match_parent"                 android:layout_height="match_parent"                 android:entries="@array/date_range_options"                 android:spinnermode="dropdown" />          </linearlayout>      </android.support.v7.widget.toolbar> 

if change toolbar , add app:theme="@style/themeoverlay.appcompat.dark.actionbar" below:

<android.support.v7.widget.toolbar         android:id="@+id/bottom_toolbar"         android:layout_width="match_parent"         android:layout_height="?attr/actionbarsize"         android:background="?attr/colorprimary"         app:theme="@style/themeoverlay.appcompat.dark.actionbar"         app:popuptheme="@style/themeoverlay.appcompat.light"         android:layout_alignparentbottom="true"> 

i white text color of spinners selected text popup background becomes dark white text color well.

i want have while text color in selected , white popup background black text.

how do this?

you can use theme this

<android.support.v7.widget.appcompatspinner                 android:id="@+id/date_range"                 android:layout_width="match_parent"                 android:layout_height="match_parent"                 android:entries="@array/date_range_options"                 android:theme="@style/spinnerstyle                 android:spinnermode="dropdown" /> 

and in styles file

<style name="spinnerstyle" parent="apptheme">     <item name="colorcontrolnormal">@color/white_text</item>     <item name="colorcontrolactivated">@color/white_text</item>     <item name="colorcontrolhighlight">@color/white_text</item> </style> 

replace @color/white_text whatever color want use.


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -