加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

在drawable下的xml文件中layer-list的用法一:直接指定已有图片

发布时间:2020-12-16 02:15:54 所属栏目:百科 来源:网络整理
导读:layer-list可以实现多个图片的叠加 一,在drawable目录下创建layer.xml 其中,left,top,right,bottom属性可以设置上层图片距离底层图片的上下左右的边距 [html] view plain copy layer-list xmlns:android = "http://schemas.android.com/apk/res/android" i

layer-list可以实现多个图片的叠加

一,在drawable目录下创建layer.xml

其中,left,top,right,bottom属性可以设置上层图片距离底层图片的上下左右的边距
[html] view plain copy
  1. <layer-listxmlns:android="http://schemas.android.com/apk/res/android">
  2. <itemandroid:drawable="@drawable/photoa"/>
  3. <itemandroid:left="10.0dip"
  4. android:top="18.0dip"
  5. android:right="25.0dip"
  6. android:bottom="35.0dip"
  7. android:drawable="@drawable/photob"
  8. />
  9. </layer-list>

二,在布局文件中引用layer.xml

[html] view plain copy
  1. <ImageView
  2. android:layout_width="wrap_content"
  3. android:layout_height="wrap_content"
  4. android:src="@drawable/layer"/>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读