0
我创造了这个绘制资源,backgroundactivity
,因为我的应用程序的后台使用方法:背景绘制不起作用
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<item
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<shape
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<gradient
android:angle="90"
android:startColor="#BFEFFF"
android:centerColor="#B0E2FF"
android:endColor="#82CFFD"
android:type="linear"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</shape>
</item>
</selector>
我想设置我的所有活动这样的背景,所以我试图把在styles.xml
这样这样绘制资源:
<resources>
<!-- 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:actionBarStyle">@style/MyActionBar</item>
<item name="android:background">@drawable/backgroundactivity</item>
</style>
<style name="MyActionBar" parent="@android:style/Widget.Holo.Light.ActionBar">
<item name="@android:background">@color/colorPrimary</item>
</style>
</resources>
但这种方式没有奏效:背景仍停留白色为默认值。我也试图用android:windowBackground
替换android:background
,但它会导致我的应用程序变为完全黑屏。
在此先感谢!
哦,对不起,这只是一个错字,我写的疑问线时作:我的应用程序没有'.xml'所以它不是问题 – Clyky
发布backgroundactivity.xml代码:) – Inkognito
它是第一个xml代码 – Clyky