1
我在theme.xml文件中定義了全局樣式。這包括項目<item name="colorControlActivated">@color/white</item>
。Android - 覆蓋theme.xml樣式
我有一個DatePicker選擇日期背景使用這個樣式項目,因此是白色的...在白色背景上。所選日期因此不可見。
這是的DatePicker:
<DatePicker
android:id="@+id/DatePicker"
style="@style/date_picker_theme"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:calendarViewShown="false"
android:descendantFocusability="blocksDescendants"
android:endYear="2100"
android:startYear="1900" />
,我試圖重寫colorControlActivated
風格(在styles.xml)這樣的:
<style name="date_picker_theme">
<item name="colorControlActivated">@color/green</item>
</style>
但是,這並不在所有的體現。
如果我將theme.xml樣式項目更改爲<item name="colorControlActivated">@color/green</item>
,那麼它反映得很好,但可能會改變整個應用程序的其他樣式。
問題:我如何覆蓋這隻適用於我的DatePicker?
現在它的外觀:
那應該怎麼看: