android - Spinner text color -


i want have different text color on spinners dropdown-list , standard text of item have selected.

the standard text color of spinner white , text color on popup dropdown list. problem background on spinner popup white, can't see white text on white background. want keep background white , text color of item see when haven't expanded dropdown list white textcolor of items in dropdown-list black.

this code spinner:

<android.support.v7.widget.appcompatspinner android:id="@+id/editspinnerworksites" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/edittextprofilelastname" android:textcolor="@color/white_base" android:textcolorhint="@android:color/white" android:fontfamily="sans-serif" android:spinnermode="dialog" style="@style/widget.appcompat.spinner.underlined"/> 

and code custom textview of spinner

   <textview     android:id="@+id/text_view     android:layout_width="match_parent"     android:layout_height="match_parent"     android:gravity="start|center"     android:fontfamily="sans-serif"     android:textsize="17dp"     android:drawablepadding="13dp"     android:textcolor="@color/white" /> 

you can create custom layout spinner.

adapter = new arrayadapter<string>(this,r.layout.custom_spinner_item, list); adapter.setdropdownviewresource(r.layout.custom_dropdown_item);  

custom_spinner_item

<textview xmlns:android="http://schemas.android.com/apk/res/android"  android:id="@android:id/text1" style="?android:attr/spinneritemstyle" android:singleline="true" android:layout_width="match_parent" android:layout_height="wrap_content" android:ellipsize="marquee" android:textalignment="inherit" android:textcolor="@color/red"/> 

you can declare same drop down list.

i hope problem solved.


Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -