lom*_*mza 10 android background
在我的应用程序中,我有很多图层,而不是为每个图层设置背景图像,我想一劳永逸地设置背景.我怎样才能做到这一点?
Ada*_*hns 10
添加android:windowBackground
到您的主题:
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:windowBackground">@color/colorPrimaryDark</item>
</style>
Run Code Online (Sandbox Code Playgroud)
当然,请确保您的清单为您的应用程序使用主题:
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.package.name"
xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
Run Code Online (Sandbox Code Playgroud)