ganfra / MaterialSpinner

Spinner with Material Design - Down to API 14
Apache License 2.0
946 stars 214 forks source link

How to change spinner selected text color? #146

Open amol-bhagwat opened 5 years ago

RahathNavith commented 5 years ago

hi, if you find the solution . please update.

andiwijayaid commented 5 years ago

You can create new layout. For example, I named it item_spinner

<?xml version="1.0" encoding="utf-8"?>
<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:textColor="@color/colorAccent"
          android:layout_height="wrap_content"
          android:ellipsize="marquee"
          android:textAlignment="inherit"/>

Refrence the layout that you made to adapter

val adapter = ArrayAdapter(applicationContext, R.layout.item_spinner, items)
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)

@RahathNavith @amol-bhagwat

Chivorns commented 5 years ago

Hi you can try to check this library: https://github.com/Chivorns/SmartMaterialSpinner. Hope it can help what you need