我在寻找一个possibilitie调整日期选择控件的文本颜色在Android蜂窝应用程序。我知道小部件固有的全球文字颜色是白色的在我的情况,但我需要一个黑色的文本颜色的日期选择器作为这里的背景是浅灰色。
I'm searching for a possibilitie to adjust the text color of the datepicker widget in an android honeycomb app. I knew that the widget inherent the global text-color which is white in my case, but i need a black text-color for the datepicker as the background here is light grey.
任何人都知道如何解决这个问题?
Anyone know how to fix this?
做了
做了一个主题,在应用程序styles.xml(基本设置的样式上的所有的EditText字段)
Did it in a Theme in the application styles.xml (basically set a style on all EditText fields)
我有这样的/值-V11 /所以它不仅影响> HC
I have this in /values-v11/ so it only affects >HC
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="Theme.SelectDate" parent="@android:style/Theme.Holo.NoActionBar">
<item name="android:editTextStyle">@style/Widget.EditText.Black</item>
</style>
<style name="Widget.EditText.Black" parent="@android:style/Widget.EditText">
<item name="android:textColor">@color/black</item>
</style>
</resources>
然后在我的AndroidManifest,为活动使用的DatePicker的:
Then in my AndroidManifest, for the Activity that uses the DatePicker:
<activity
android:name=".ui.phone.SelectDateActivity"
android:label="Date Selection"
android:screenOrientation="portrait"
android:theme="@style/Theme.SelectDate" />
这就是它!
我的工作了的:
我得出这一结论通过检查的DatePicker来源:
I came to this conclusion by checking the DatePicker source:
https://github.com/android/platform_frameworks_base/blob/master/core/res/res/layout/date_picker.xml
这表明我的DatePicker使用NumberPicker
That showed me the DatePicker used NumberPicker
https://github.com/android/platform_frameworks_base/blob/master/core/res/res/layout/number_picker.xml https://github.com/android/platform_frameworks_base/blob/master/core/res/res/layout/number_picker_with_selector_wheel.xml
该NumberPicker使用一个EditText
The NumberPicker uses an EditText
因此,您可以风格一个EditText
You can therefore style an EditText
android :?如何改变编辑文本的样式
如果你在这个文件中的EDITTEXT搜索,你会看到,你可以在一个活动中设置的样式上的所有的EditText领域!
And if you search in this file for "editText" you will see you can set a style on all edittext fields in one Activity!
https://github.com/android/platform_frameworks_base/blob/master/core/res/res/values/themes.xml
您覆盖该项目:
<item name="editTextStyle">@android:style/Widget.EditText</item>
上一篇:机器人的WebView无法呈现的YouTube视频通过iframe中嵌入机器人、视频、YouTube、WebView
下一篇:如何处理的AsyncTask在ActionBarActivity片段时ViewPager使用?如何处理、片段、ActionBarActivity、AsyncTask