Android自定义Shape 加上阴影shadow之方法(2)
来源:LinuxIDC.com
作者:LinuxIDC.com
= "utf-8" ?>
< layer-list xmlns:Android = "http://schemas.android.com/apk/res/android" >
< item >
< bitmap Android:src = "@drawable/android_red"
Android:gravity = "center" />
item >
< item Android:top = "10dp" android:left = "10dp" >
< bitmap Android:src = "@drawable/android_green"
Android:gravity = "center" />
item >
< item Android:top = "20dp" android:left = "20dp" >
< bitmap Android:src = "@drawable/android_blue"
Android:gravity = "center" />
item >
layer-list >
="http://schemas.android.com/apk/res/android"> -
-
-
Notice that this example uses a nested
element to define the drawable resource for each item with a "center" gravity. This ensures that none of the images are scaled to fit the size of the container, due to resizing caused by the offset images.
This layout XML applies the drawable to a View:
This layout XML applies the drawable to a View:
< ImageView
Android:layout_height = "wrap_content"
Android:layout_width = "wrap_content"
Android:src = "@drawable/layers" />
:layout_height="wrap_content" android:layout_width="wrap_content" android:src="http://www.linuxidc.com/@drawable/layers" />
The result is a stack of increasingly offset images:
see also:
时间: 2011-10-15 10:20
来源 :LinuxIDC.com
作者 :LinuxIDC.com
原文链接
------分隔线----------------------------