Android的蜂窝状的DatePicker文字颜色 [英] Android HoneyComb DatePicker Text Color
问题描述
我在寻找一个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:
<一个href="https://github.com/android/platform_frameworks_base/blob/master/core/res/res/layout/date_picker.xml">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
<一个href="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.xml <一href="https://github.com/android/platform_frameworks_base/blob/master/core/res/res/layout/number_picker_with_selector_wheel.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
<一个href="http://stackoverflow.com/questions/7188339/android-how-to-change-the-style-of-edit-text">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!
<一个href="https://github.com/android/platform_frameworks_base/blob/master/core/res/res/values/themes.xml">https://github.com/android/platform_frameworks_base/blob/master/core/res/res/values/themes.xml
您覆盖该项目:
<item name="editTextStyle">@android:style/Widget.EditText</item>
这篇关于Android的蜂窝状的DatePicker文字颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!