layer-list

 <layer-list> :图层列表

                                                                                                       最简单的效果

                                                                     

          

              简单的使用:res/drawable/xxx.xml 下,将<layer-list>作为根元素,XML命名空间必须是"http://schemas.android.com/apk/res/android"

 <item>作为其子对象,分别绘制不同的对象。

      

         android:width 宽度

         android:height 高度

         android:top  顶部偏移(相对手机的上下左右)

         android:right 右边偏移(同上)

         android:bottom 底部偏移(同上)

         android:left 左边偏移(同上) 

     xxx.xml文件将当做图片一样在可以被引用   

代码:

  xxx.xml :

<?xml version="1.0" encoding="utf-8"?>
   <layer-list   xmlns:android="http://schemas.android.com/apk/res/android">
       <item android:drawable="@color/colorAccent"
           android:width="80dp"
           android:height="80dp"></item>
       <item android:drawable="@color/colorPrimary"
           android:width="80dp"
           android:height="80dp"
           android:top="30dp"
           android:left="30dp">
       </item>
   </layer-list>


被引用:

<ImageView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/xxx"/>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值