background image

            android:layout_width="match_parent"
            android:layout_height="match_parent" />

        <!-- The navigation drawer -->

        <ListView
            android:id="@+id/left_drawer"
            android:layout_width="240dp"
            android:layout_height="match_parent"
            android:layout_gravity="left"
            android:background="#111"
            android:choiceMode="singleChoice"
            android:divider="@android:color/transparent"
            android:dividerHeight="0dp" />
    </android.support.v4.widget.DrawerLayout>

</RelativeLayout>
复制代码
 DrawerLayout 的第一个子元素是主要内容,即抽屉没有打开时显示的布局。这里采用了
一个 FrameLayout,里面什么也没放。
  DrawerLayout 的第二个子元素是抽屉中的内容,即抽屉布局,这里采用了一个
ListView。

  主要的 Activity(从官方实例中扒出来的):
package com.example.hellodrawer;

import android.os.Bundle;
import android.app.Activity;
import android.content.res.Configuration;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.support.v4.app.ActionBarDrawerToggle;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;

public class HelloDrawerActivity extends Activity
{

                     找软件资料,就到一览软件文库

http://wk.yl1001.com/rj/