Android导航抽屉垂直边框

Sar*_*mer 5 android android-layout navigation-drawer

我想让我的NavigationDrawer就像在这个应用程序中一样

在此输入图像描述

更具体地说,我想在右侧添加一个小的1像素边框

在此输入图像描述

但这是我抽屉里的东西 在此输入图像描述

这是抽屉片段的xml

<ListView 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:background="#E7E7E7"
android:choiceMode="singleChoice"
android:dividerHeight="0.5dp" />
Run Code Online (Sandbox Code Playgroud)

我需要做什么?

Apu*_*rva 4

尝试这个,

DrawerLayout mDrawerLayout;

onCreate(Bundle ...){
    //...
    mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow,
                    GravityCompat.START);
    //...
}
Run Code Online (Sandbox Code Playgroud)

编辑

您需要添加一个View并用一个水平ListView包裹两个并给两个都一些重量。这里我给了权重和权重 to ,你可以根据你的要求改变它。LinearLayout0.99listView0.01view

<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"
        android:orientation="horizontal">

        <ListView android:id="@+id/drawer_list"
            android:layout_weight="0.99"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="#E7E7E7"
            android:choiceMode="singleChoice"
            android:dividerHeight="0.5dp" />

        <View
            android:layout_weight="0.01"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:background="#eeccbb"/>
    </LinearLayout>

</android.support.v4.widget.DrawerLayout>
Run Code Online (Sandbox Code Playgroud)