android - How do I change the font color of the selection list in a spinner? -


i've created spinner, user can select value. can change textcolor of spinner shown in picture:

enter image description here

unfortunately when press spinner list of items, selected, shown, these have white font color on white background, , haven't been able change this: enter image description here

i've googled problem , others have experienced same problem. none of fixes suggested worked me. far understand have make custom list of kind, well.. i'm not able make work. suggestions?

my code looks (array_spinner array of strings):

arrayadapter adapter = new arrayadapter(this, r.layout.row, array_spinner); adapter.setdropdownviewresource(android.r.layout.simple_spinner_dropdown_item); 

and row.xml:

<?xml version="1.0" encoding="utf-8"?> <textview xmlns:android="http://schemas.android.com/apk/res/android"     android:id="@+id/spinnertext"      android:layout_width="fill_parent"     android:layout_height="wrap_content"      android:layout_centerhorizontal="true"     android:textcolor="#000000"      android:textsize="14dp" /> 

try (untested). i'm reproducing simple_spinner_dropdown_item.xml black text color:

  • replace line
    arrayadapter adapter = new arrayadapter(this, r.layout.row, array_spinner);     adapter.setdropdownviewresource(android.r.layout.simple_spinner_dropdown_item); 

with

arrayadapter adapter = new arrayadapter(this, r.layout.row, array_spinner); adapter.setdropdownviewresource(r.layout.spinner_dropdown_item); 
  • add file in res/layout, called spinner_dropdown_item.xml:
<checkedtextview    android:id="@android:id/text1"    style="?android:attr/spinnerdropdownitemstyle"    android:singleline="true"    android:layout_width="fill_parent"    android:layout_height="?android:attr/listpreferreditemheight"   android:textcolor="#ff000000" /> 

Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -