arcadefire / nice-spinner

A nice spinner for Android
Apache License 2.0
2.85k stars 445 forks source link

How to use "backgroundSelector"? #94

Closed Charay closed 5 years ago

Charay commented 5 years ago

How to use "backgroundSelector"?

arcadefire commented 5 years ago

You can have a look at the sample app to see how to use it.

In short, just set NiceSpinner's:

app:backgroundSelector="@drawable/background_selector"

where your background_selector resource could be something like this:

<ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="@color/colorPrimaryDark">
<item>
    <selector>
        <item
            android:drawable="@android:color/white"
            android:state_checked="false"/>
        <item
            android:drawable="@color/colorPrimary"
            android:state_checked="true" />
        <item
            android:drawable="@color/colorPrimaryDark" />
    </selector>
</item>
</ripple>

Hope it helps.