如何在Android中制作具有这些功能的导航抽屉?

时间:2014-08-11 10:54:41

标签: android android-layout android-fragments

我想实施一个 Android应用来测量某人在体育活动中的表现。

我遇到的问题是我必须从屏幕左侧实现滑动菜单,可以更改必须注册演出的帐户。 我不知道如何制作这张照片中显示的部分。

可以通过点击添加新用户按钮添加新用户,点击笔编辑帐户,然后切换到其他帐户< / strong>在处于非活动状态时单击它。

我已经搜索了有关如何执行此操作的信息,但我没有找到与此相关的任何内容。

这是我的应用必须看的方式:enter image description here

有没有人知道如何做到这一点或类似于我的问题?

2 个答案:

答案 0 :(得分:0)

你必须去Sliding menu lib

你可以使用android DrawerLayout。 请看看。

答案 1 :(得分:0)

对NavigationDrawer有设计建议.............. 这可以帮助您创建类似的布局......

首先创建导航抽屉表单:Creating a Navigation Drawer

然后更改Drawelayout.xml中的一些代码(包含nav。抽屉)

navDrawer.xml

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res/com.equest.cwely.act"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <!-- The main content view -->

    <FrameLayout
        android:id="@+id/content_frame"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
    </FrameLayout>

    <!-- The navigation drawer -->

    <LinearLayout
        android:id="@+id/drawer"
        android:layout_width="300dp"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:background="@color/actionbar_bg"
        android:orientation="vertical" >

        <include
            android:id="@+id/nav_list_header"
            layout="@layout/nav_profile" />

        <ListView
            android:id="@+id/drawer_list"
            android:layout_width="300dp"
            android:layout_height="match_parent"
            android:layout_gravity="start"
            android:layout_marginTop="10dp"
            android:choiceMode="singleChoice"
            android:divider="#55ffffff"
            android:dividerHeight="0.5dp"
            android:listSelector="@drawable/list_selector" />
    </LinearLayout>

</android.support.v4.widget.DrawerLayout>

下面,

<include/>:我创建了一个布局并将其添加到navDrawerLayout文件中...

<ListView/>:第二个布局...........