-1

how to change text color of spinner item ithout custom adapter
styles.xml

<style name="MyTheme1" parent="Theme.AppCompat.Light">
    <item name="android:textAppearanceListItemSmall">@style/MySpinnerStyle</item>
</style>

<style name="MySpinnerStyle" parent="TextAppearance.AppCompat.Subhead">
    <item name="android:textSize">13sp</item>
    <item name="android:textColor">@color/white</item>
</style>

i am adding style to spinner

 <Spinner
      style="@style/MySpinnerStyle"
      android:id="@+id/cases"
      android:layout_width="wrap_content"
      android:layout_height="60dp"
      android:layout_alignParentBottom="true"
      android:layout_alignParentStart="true"
      android:dropDownVerticalOffset="60dp"
      android:entries="@array/main_array" />
AskNilesh
  • 67,701
  • 16
  • 123
  • 163
shwetag21
  • 33
  • 6
  • 1
    check this link https://stackoverflow.com/questions/9476665/how-to-change-spinner-text-size-and-text-color – AskNilesh Sep 12 '17 at 06:09

1 Answers1

0

You need to create layout with TextView

<?xml version="1.0" encoding="utf-8"?>
<TextView  
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent" 
    android:layout_height="wrap_content"
    android:textSize="18sp"
    android:gravity="left"  
    android:textColor="what_ever_color_you want_specify_here"         
    android:padding="5dp"
    />

inflate this layout using Spinner adapter

ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.your_custom_layout,list);
AskNilesh
  • 67,701
  • 16
  • 123
  • 163
akshay_shahane
  • 4,423
  • 2
  • 17
  • 30