Zankhna
Zankhna

Reputation: 4563

Change style of sherLock Spinner control android

In my android application i am using sherLock Spinner control. I am not using this control in Actionbar. I used this spinner control to achieve dropdown functionality through spinner control. The problem is that i don't know how to change the style of sherlock spinner control. I don't know, where I should make changes to set new style for Sherlock Spinner control. Please help me to solve this problem. Thank you.

Upvotes: 2

Views: 2166

Answers (1)

Zankhna
Zankhna

Reputation: 4563

After many trial, I found solution of this question. To change the style of sherlock spinner, we have to provide styles to spinner in our application which will override default style of sherlock spinner.

Styles.xml

 <style name="spinner_style" parent="Widget.Sherlock.Light.Spinner.DropDown.ActionBar">
    <item name="android:dropDownWidth">290dp</item>
    <item name="background">#18c3ef</item>
    <item name="android:background">@drawable/spinner_background_holo_light</item>
    <item name="android:popupBackground">#ffffff</item>
    <item name="android:divider">@color/black</item>
    <item name="android:dividerHeight">3dp</item>
    <item name="android:scrollbars">none</item>
    <item name="android:dropDownSelector">@android:color/darker_gray</item>
    <item name="android:scrollbarAlwaysDrawVerticalTrack">false</item>
    <item name="android:scrollbarTrackVertical">@android:color/darker_gray</item>
</style>

Applying style to sherlock spinner in our layout file

main.xml

        <com.app.sherelock.internal.widget.IcsSpinner
            android:id="@+id/ics_spinner"
            style="@style/spinner_style"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

Upvotes: 3

Related Questions