1. 程式人生 > >Layer_list(層疊圖片)

Layer_list(層疊圖片)

layer_list.xml(定義在Drawable-hdpi資料夾下)

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
    <item>
        <bitmap android:src="@drawable/hd_1"
            android:gravity="center"/>
    </item>
    <item android:top
="10dp" android:left="10dp">
<bitmap android:src="@drawable/hd_2" android:gravity="center"/> </item> <item android:top="10dp" android:left="20dp"> <bitmap android:src="@drawable/hd_3" android:gravity="center"/> </item> </layer-list
>

layout_main.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen
/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.example.hd.layer_list.MainActivity" > <ImageView android:layout_height="wrap_content" android:layout_width="wrap_content" android:src="@drawable/layer_drawble"/> <Button android:id="@+id/btn_1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/button_selector"/> </RelativeLayout>