如何将背景图片添加到形状?代码我试过下面但没有成功:
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" android:padding="10dp"> //here is where i need to set the image <solid android:color="@drawable/button_image"/> <corners android:bottomRightRadius="5dp" android:bottomLeftRadius="5dp" android:topLeftRadius="5dp" android:topRightRadius="5dp"/> </shape>
提前致谢。
使用以下图层列表:
<?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item android:drawable="@drawable/image_name_here" /> <item> <shape android:shape="rectangle" android:padding="10dp"> <corners android:bottomRightRadius="5dp" android:bottomLeftRadius="5dp" android:topLeftRadius="5dp" android:topRightRadius="5dp"/> </shape> </item> </layer-list>