---
title: "SlidingDrawer滑动抽屉"
author: "Java-Object"
date: "2013-06-27T00:47:51Z"
tags: []
categories: ["编程语言"]
slug: "slidingdrawer"
draft: false
lastmod: "2013-06-27T00:48:49Z"
id: 1894965
url: "https://hezd.iteye.com/blog/1894965"
---

```
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <!--
        定义一个滑动抽屉指定handle，content两个属性
    	子节点引用handle把手和content要显示的内容
    -->

    <SlidingDrawer
        android:id="@+id/sliding_drawer"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:content="@+id/content"
        android:handle="@+id/handle"
        android:orientation="horizontal" >

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="match_parent" 
            android:orientation="vertical">

            <ImageView
                android:id="@id/handle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/ic_launcher" />
        </LinearLayout>

        <LinearLayout
            android:id="@id/content"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical" >

            <TextView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:gravity="center"
                android:text="我是slidingDrawer的内容" />
        </LinearLayout>
    </SlidingDrawer>

</LinearLayout>
```