0

我在xml中有这段代码:

<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >

<gradient
    android:angle="90"
    android:endColor="#222288"
    android:startColor="#9966cc" />

如何在渐变上添加重复的图像?用于 Android 项目的背景层。像这样的东西,但对于 Android:

<style type="text/css">
body {
background-color: #666;
background-image:url(repeated_image.gif)
}
</style>
4

1 回答 1

0

好的,我的答案是使用带有形状和位图的图层列表:

<?xml version="1.0" encoding="utf-8"?>

<item>
    <shape
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:shape="rectangle" >
        <gradient
            android:angle="90"
            android:endColor="#222288"
            android:startColor="#9966cc" />
    </shape>
</item>
<item>
    <bitmap
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:src="@drawable/repeated_image"
        android:tileMode="repeat" />
</item>

于 2013-05-15T12:57:29.910 回答