Android Honeycomb: how to stylize the right corner of an arrow in a spinner on an ActionBar

This is a pretty specific question. I have a counter in an ActionBar that is added to the onCreate () method. I was able to style the text with white, but I can’t get the underline, and the triangle / arrow at the bottom right looks white. Here is my style:

<item name="android:actionDropDownStyle">@style/customActionBarDropDownStyle</item> <style name="customActionBarDropDownStyle" parent="android:style/Widget.Holo.Light.Spinner"> <item name="android:textColor">#FFFFFF</item> </style> 

I cannot find a style element / property that makes the underline and triangle white. Is there one of them?

Here is an example. I highlighted the red triangle and emphasize that I want to make white.

enter image description here

+8
android android-actionbar android-3.0-honeycomb spinner
source share
3 answers

The answer is a bit late, but better than never :) You should create a new 9 patch drawable and set it as background for android: actionDropDownStyle.

here is an example:

  <item name="android:actionDropDownStyle">@style/customActionBarDropDownStyle</item> <style name="customActionBarDropDownStyle"parent="android:style/Widget.Holo.Light.Spinner"> <item name="android:background">@drawable/custom_spinner_dropdown</item> </style> 

You cannot set the color for almost every native component, since their backgrounds (in most cases) are 9-patch png.

+7
source share

The DropDownStyle action cannot be used to change the style of the item you added in the action bar; it for one of the modes of the ActionBar.NAVIGATION_MODE_LIST action bar;

As for your problem, you can define a selector for your counter in the layout file, like this:

 enter code here <Spinner android:dropDownWidth="200dp" android:background="@drawable/actionbar_spinner" android:id="@+id/action_spinner" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_marginRight="10dp" /> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_enabled="false" android:drawable="@drawable/spinner_ab_disabled" /> <item android:state_pressed="true" android:drawable="@drawable/spinner_ab_pressed" /> <item android:state_pressed="false" android:state_focused="true" android:drawable="@drawable/spinner_ab_focused" /> <item android:drawable="@drawable/spinner_ab_default" /> </selector> 
+1
source share

Try the following: android:background="@null"

0
source share

All Articles