且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将图像添加到具有形状的图层列表项

更新时间:2023-12-05 16:32:40

如果您想要带有边框的背景,请尝试以下操作:

If your want a background with border, try this:

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">  
    <item android:drawable="@drawable/background" />
    <item 
        <shape>
            <solid/>
            <stroke android:width="1dip" android:color="#225786" />
            <corners android:radius="10dip"/>
            <padding android:left="0dip" android:top="0dip" android:right="0dip" android:bottom="0dip" />
        </shape>
    </item> 
  </layer-list> 

如果您只想要背景,请尝试以下方法:

and if your just want a background, try this one:

<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
    android:src="@drawable/background"
    android:tileMode="repeat" >

</bitmap>