我只是试图改变一个活动的背景颜色,但是没有什么改变。
以下是相关的XML:
styles.xml
<resources>
<style name="STBTheme" parent="android:Theme.Light" >
<item name="android:windowBackground">@color/blue</item>
</style>
</resources>AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.pedro.stb"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="15" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/STBTheme" >
<activity
android:name=".MainActivity"
android:label="@string/title_activity_main"
android:theme="@style/STBTheme" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>此外,我使用的是Eclipse,通过更改活动的xml中的主题,它不会改变图形布局。
有什么帮助吗?
编辑让它开始工作了。在重新加载布局之前,必须清理项目。很烦人..。
发布于 2012-10-29 08:51:19
我检查了你的密码没问题。
试试<item name="android:Background">#ccff33</item>
而不是<item name="android:windowBackground">@color/blue</item>.
您还可以在应用程序中编写android:theme="@style/STBTheme" >,也可以编写活动。
只需在应用程序标签中写入即可。
希望你现在能得到你的产出。
发布于 2017-10-13 03:03:23
您将更改当前活动的主题。
我不知道为什么Android Studio有时会表现得像喝醉了一样。我有两个具有相同目标的项目,最小SDK。其中一个实现了正确的splash屏幕主题,另一个直到我找到了解决办法才会显示出来。
https://stackoverflow.com/questions/13118109
复制相似问题