How can I style ActionBar Drop-down Navigation spinner in my custom layout?
The only part of the Spinner
you can theme is the background by applying your own style using the actionDropDownStyle
attribute. Here's an example:
<style name="Your.Theme" parent="@android:style/Theme.Holo.Light">
<item name="android:actionDropDownStyle">@style/Your.Spinner</item>
</style>
<style name="Your.Spinner" parent="@android:style/Widget.Holo.Light.Spinner">
<item name="android:background">@drawable/your_background</item>
</style>
Also, how can I change the size of a spinner?
I think you're asking how to change the layout params of the Spinner
, in which case you can't.
The Spinner
in the ActionBar
is created internally using the ScrollingTabContainerView
. By default the width is set to LinearLayout.LayoutParams.WRAP_CONTENT
and the height is set to LinearLayout.LayoutParams.MATCH_PARENT
. But nothing in the ActionBar
API allows you to modify the size of the Spinner
.
An alternative is to use ActionBar.setCustomView
and inflate a layout that contains your own Spinner
.