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

来源:互联网 发布:电子账单软件 编辑:程序博客网 时间:2024/04/30 03:34

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

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

其中,left,top,right,bottom属性可以设置上层图片距离底层图片的上下左右的边距
[html] view plain copy
  1. <layer-list xmlns:android="http://schemas.android.com/apk/res/android">  
  2.     <item android:drawable="@drawable/photoa"/>  
  3.     <item android: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"/> 
0 0
原创粉丝点击