android图片叠加的功能,这个应该在设置头像的时候很经常用到。
1、创建drawable xml文件
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<!-- 最底层的图片,以x,y轴坐标为中心进行旋转-->
<rotate android:pivotX="0" android:pivotY="0"
android:fromDegrees="-10" android:toDegrees="-10">
<bitmap android:src="@drawable/chatting_bg_default_thumb"/>
</rotate>
</item>
<!-- 第二层的图片,以x,y轴坐标为中心进行旋转-->
<item>
<rotate android:pivotX="0" android:pivotY="0"
android:fromDegrees="15" android:toDegrees="15">
<bitmap android:src="@drawable/chatting_bg_purecolor_thumb"/>
</rotate>
</item>
<!-- 最上层的图片,以x,y轴坐标为中心进行旋转-->
<item>
<rotate android:pivotX="0" android:pivotY="0"
android:fromDegrees="35" android:toDegrees="55">
<bitmap android:src="@drawable/mark"/>
</rotate>
</item>
</layer-list>
布局文件中添加创建的图片
< ImageView |
12 | android:layout_width = "wrap_content" |
13 | android:layout_height = "wrap_content" |
14 | android:src = "@drawable/layer_image" /> |
![](http://img2.51cto.com/attachments/month_1308/20130809_dbcb47149d1cb49dc51b9J8k5OgdSLqo.jpg.thumb.jpg)