如何使无动作条导览列 [英] How to make navigation drawer without actionbar

查看:205
本文介绍了如何使无动作条导览列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想实现导航抽屉里,连动作条

I am trying to implement navigation drawer without ActionBar.

有一个小的布局,它里面有一个按钮。
当单击该按钮,然后抽屉式导航栏将打开。抽屉式导航栏将是下的按钮。
我怎样才能实现这个在android系统???

There is a small layout and inside it there is a button. When the button is clicked then the navigation drawer will open. The navigation drawer will be under the button. How can i implement this in android???

推荐答案

定义你的XML这样就大功告成了。

Define your xml like this and you are done

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="100dp" // static height for view or keep it dimen.xml
        android:background="#21ef70"
        android:gravity="bottom"
        android:orientation="horizontal">

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Click"
            android:id="@+id/button2" />
    </LinearLayout>
</LinearLayout>

<!-- Listview to display navigation menu -->
<ListView
    android:id="@+id/list_slidermenu"
    android:layout_width="240dp"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:layout_marginTop="100dp" // same margin as of layout
    android:choiceMode="singleChoice"
    android:dividerHeight="1dp" />
</android.support.v4.widget.DrawerLayout>

这篇关于如何使无动作条导览列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆