如何在Eclipse中更改应用程序主题

时间:2014-08-05 14:23:20

标签: android xml eclipse android-theme android-appcompat

我想将Date Picker的背景从白色更改为黑色,我认为可以通过将我的app主题更改为holo dark来完成。

目前它是: enter image description here我想将其改为全黑enter image description here

因此,目前我的styles.xml值文件夹

<resources>

<!--
    Base application theme, dependent on API level. This theme is replaced
    by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
    <!--
        Theme customizations available in newer API levels can go in
        res/values-vXX/styles.xml, while customizations related to
        backward-compatibility can go here.
    -->
</style>

<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
    <!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>

</resources>

values-v11 styles.xml

<resources>

<!--
    Base application theme for API 11+. This theme completely replaces
    AppBaseTheme from res/values/styles.xml on API 11+ devices.
-->
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
    <!-- API 11 theme customizations can go here. -->
</style>

</resources>

values-v14 styles.xml

<resources>

<!--
    Base application theme for API 14+. This theme completely replaces
    AppBaseTheme from BOTH res/values/styles.xml and
    res/values-v11/styles.xml on API 14+ devices.
-->
<style name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- API 14 theme customizations can go here. -->
</style>

</resources>

Mainifest.xml

<application
   .....
   android:theme="@style/AppTheme" >
   .......
</application>

我正在使用appcompat_v7,那么我应该修改我的styles.xml使用Holo Light和Dark Date Picker?

3 个答案:

答案 0 :(得分:1)

当应用使用appcompat_v7解决问题时,将Theme.AppCompat设置为主题的父级!

Theme.AppCompat在视觉上与Theme.Holo(黑暗)相同。

有关详细信息,请参阅Android文档ActionBar以获取更多信息!

答案 1 :(得分:0)

解决方案 :: android:Theme.Holo


复制此代码并将其粘贴到styles.xml文件夹

中的values 值文件夹中的

styles.xml

<resources>

<!--
    Base application theme, dependent on API level. This theme is replaced
    by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Holo">
    <!--
        Theme customizations available in newer API levels can go in
        res/values-vXX/styles.xml, while customizations related to
        backward-compatibility can go here.
    -->
</style>

<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
    <!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>

</resources>

values-v11 styles.xml

<resources>

<!--
    Base application theme for API 11+. This theme completely replaces
    AppBaseTheme from res/values/styles.xml on API 11+ devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Holo">
    <!-- API 11 theme customizations can go here. -->
</style>

</resources>

values-v14 styles.xml

<resources>

<!--
    Base application theme for API 14+. This theme completely replaces
    AppBaseTheme from BOTH res/values/styles.xml and
    res/values-v11/styles.xml on API 14+ devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Holo">
    <!-- API 14 theme customizations can go here. -->
</style>

</resources>

Mainifest.xml

<application
   .....
   android:theme="@style/AppTheme" >
   .......
</application>

- 看看--- HOLO_EVERYWHERE - PROJECT - CLICK -HERE

- 看看--- DEVELOPER_SITE - CLICK - HERE

答案 2 :(得分:0)

确定所有个实例..

    "Theme.AppCompat.Light"

......需要改为......

    "Theme.AppCompat"

"Theme.AppCompat"appcompat的{​​{1}}版本 - 黑暗版本

您无法使用"Theme.Holo",因为您使用的是"Theme.Holo"库。它们不兼容。按照这个,它会工作!