AutoCompleteTextView has white text color when setting Theme_Light solution!

2010年10月6日 星期三

AutoCompleteTextView 在 Theme_Light 時 字體白色,背景也白色導致看不到.

solution!

1. use an extended theme in your manifest:
...
<application android:theme="@style/Theme.Light.NoTitleBar.mytheme" ... >
...

2. create the new theme (res/values/themes.xml) which uses fixed styles:
...
<style name="Theme.Light.NoTitleBar.mytheme" parent="@android:style/Theme.Light.NoTitleBar">
<item name="android:autoCompleteTextViewStyle">@style/AutoCompleteTextViewLight</item>
<item name="android:dropDownItemStyle">@style/Widget.DropDownItemLight</item>
</style>
...

3. create the styles (res/values/styles.xml) which fix the color:
...
<style name="AutoCompleteTextViewLight" parent="@android:style/Widget.AutoCompleteTextView">
<item name="android:textColor">@android:color/primary_text_light</item>
</style>
<style name="Widget.DropDownItemLight" parent="@android:style/Widget.DropDownItem">
<item name="android:textColor">@android:color/primary_text_light</item>
</style>
...

0 意見:

張貼留言

  © Blogger template The Professional Template II by Ourblogtemplates.com 2009

Back to TOP