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>  


  • 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:

     

    Xml代码
    1. <ImageView  
    2.     Android:layout_height="wrap_content"  
    3.     Android:layout_width="wrap_content"  
    4.     Android:src="@drawable/layers" />  
     

    The result is a stack of increasingly offset images:

    see also:

    时间:2011-10-15 10:20 来源:LinuxIDC.com 作者:LinuxIDC.com 原文链接

    好文,顶一下
    (14)
    53.8%
    文章真差,踩一下
    (12)
    46.2%
    ------分隔线----------------------------


    把开源带在你的身边-精美linux小纪念品
    论坛精华
    一周热点
    无觅相关文章插件,快速提升流量