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.
Asked
Active
Viewed 2,163 times
1 Answers
3
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" />

Zankhna
- 4,570
- 9
- 62
- 103
-
class cast exception occur. kindly help ? – Saad Bilal Jan 17 '14 at 14:16
-
Are you using `Actionbar Sherlock` or `Actionbar Compat`? – Zankhna Jan 20 '14 at 05:15
-
have you imported `com.packeg.sherelock.internal.widget.IcsAdapterView` and `com.packeg.sherelock.internal.widget.IcsSpinner` in your activtiy? – Zankhna Jan 20 '14 at 08:41
-
i imported only com.packeg.sherelock.internal.widget.IcsSpinner – Saad Bilal Jan 20 '14 at 09:55
-
ok try clean and build and if it doesn't work then can you post your layout xml? – Zankhna Jan 20 '14 at 10:44
-
thanks zanky, i will try and if found any problem then i tell you, thanks a lot – Saad Bilal Jan 21 '14 at 06:23