android - Change holo spinner text colour -
i have spinner in holo theme dialog , trying change text colour because hard read:
i have looked @ android styles.xml, many other answers, , believe setting custom style correctly; it's not getting picked up.
this extract dialog layout file spinner lives:
<spinner android:id="@+id/spn_type" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:entries="@array/dose_type_options" style="@style/dialogspinner" />
and these relevant entries in styles.xml in values-v14 folder:
<style name="dialogspinner" parent="@android:style/widget.holo.spinner"> <item name="android:spinneritemstyle">@style/myspinneritem</item> </style> <style name="myspinneritem" parent="android:widget.holo.textview.spinneritem"> <item name="android:textappearance">@style/mytextappearancespinneritem</item> </style> <style name="mytextappearancespinneritem" parent="android:textappearance.holo.widget.textview.spinneritem"> <item name="android:textcolor">#fff</item> </style>
the dialog forced holo dark theme using:
<style name="fibrodialog" parent="@android:style/theme.holo.dialog"> </style>
can identify why spinner text isn't white?
i have looked @ other solutions, suggest changing colour in code, app supports 2.3.* upwards, non-holo versions black text fine, hence trying styles.
thanks
updated using answer woda below
the text colour of initial value of spinner white, goes long way highlighting there spinner there user:
but text colour of selectable items still black. guess it's not massive deal, @ least existence of spinner has been affirmed getting initial text changed white. interested know why items still black, , how change them white.
have tried accept spinneritemstyle theme? spinners in app would've same style. i'm using , works:
theme.xml:
<style name="exampletheme" parent="android:theme.holo.light"> <item name="android:spinneritemstyle">@style/spinneritem_example</item> ... </style>
style.xml:
<style name="spinneritem_example" parent="android:textappearance.widget.textview.spinneritem"> <item name="android:textcolor">#000000</item> </style>
update: taking deeper styles.xml brought me this:
<style name="widget.dropdownitem.spinner"> <item name="android:checkmark">?android:attr/listchoiceindicatorsingle</item> </style> <style name="widget.dropdownitem"> <item name="android:textappearance">@style/textappearance.widget.dropdownitem</item> <item name="android:paddingstart">@dimen/dropdownitem_text_padding_left</item> <item name="android:paddingend">@dimen/dropdownitem_text_padding_right</item> <item name="android:gravity">center_vertical</item> </style>
so need customize widget.dropdownitem , accept in theme.
... <item name="dropdownitemstyle">@android:style/widget.dropdownitem</item> ...
for customizing application following 2 links helped me lot understand structure of different views. these 2 files part of android source code. may helps too.
Comments
Post a Comment