【发布时间】:2017-12-31 10:29:07
【问题描述】:
我只是想改变一个活动的背景颜色,但没有任何改变。
这里是相关的 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 中的主题,它不会在图形布局中发生变化。
有什么帮助吗?
编辑 让它工作。在重新加载布局之前必须清理项目。很烦人...
【问题讨论】:
-
您是否在此活动中使用的 XML 布局中设置了任何颜色或主题?
-
@Dharmendra 我应该在活动的 XML 中的什么位置添加它?
标签: android android-layout android-theme