Android 如何在Eclipse中更改应用程序主题
我想将日期选择器的背景从白色改为黑色,我想可以通过将我的应用程序主题改为holo dark来实现 目前是: 我想把它改成全黑 因此,当前我在values文件夹中的Android 如何在Eclipse中更改应用程序主题,android,xml,eclipse,android-theme,android-appcompat,Android,Xml,Eclipse,Android Theme,Android Appcompat,我想将日期选择器的背景从白色改为黑色,我想可以通过将我的应用程序主题改为holo dark来实现 目前是: 我想把它改成全黑 因此,当前我在values文件夹中的styles.xml是 <resources> <!-- Base application theme, dependent on API level. This theme is replaced by AppBaseTheme from res/values-vXX/styles.xml on n
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>
<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-v14style.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>
<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>
<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>
<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>
<application
.....
android:theme="@style/AppTheme" >
.......
</application>
.......
我使用的是appcompat\u v7
,那么我应该如何修改我的样式.xml
使用全息明暗日期选择器?解决方案是:android:Theme.Holo
复制此代码并将其粘贴到
values
文件夹中的styles.xml
“值”文件夹中的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>
<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-v14style.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>
<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>
<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>
<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>
<application
.....
android:theme="@style/AppTheme" >
.......
</application>
-看看---设置
主题。当应用程序使用AppCompat时,AppCompat
作为主题的父级解决了它强>
Theme.AppCompat
在视觉上与Theme.Holo(暗色)相同
有关更多信息,请参阅Android文档了解更多信息 好,所以所有的实例
"Theme.AppCompat.Light"
…需要更改为
"Theme.AppCompat"
“Theme.AppCompat”
是AppCompat
版本的“Theme.Holo”
——黑暗版
您不能使用
“Theme.Holo”
,因为您正在使用appcompat
库。它们不兼容。遵循这一点,它将工作 你到处都在用全息图吗?如果您没有使用它,请移除标签。在这里您可以找到解决问题的线索:线索总是令人沮丧和痛苦,除非解决了您的问题,否则在可视化布局编辑器中仅更改该屏幕的样式如何?@jesses.co.tt如果我们使用自定义对话框,这是可能的,但定制日期选择器将是一个巨大的麻烦!谢谢,但由于java.lang.RuntimeException:无法启动活动ComponentInfo{com…}:java.lang.IllegalStateException:您需要在此活动中使用Theme.AppCompat主题(或子代)。
@Vivekware。。。。您必须检查其他文件夹,其中也包含样式文件,可能会覆盖您的样式。。。你这么做了吗?你说的其他文件夹是什么意思?顺便说一句,styles.xml在我指定的文件夹中&我已经根据你指定的文件夹修改了所有代码!对不起,你的回答完全错了,看我的答案!我不知道您正在使用appcompat\u v7。。。。我的回答是支持v4
。。。我忘了问它。。。很高兴你能解决它!干杯