내 앱의 두 NavigationView 사이에 구분선을 추가해야합니다. (navigation_drawer_top
및 navigation_drawer_bottom
).NavigationViews 사이에 구분선 추가
나는 이것을 시도했다. 그러나 이것은 분할기를보기의 맨 위에 추가했습니다. 첫 번째 NavigationView (navigation_drawer_top
)의 끝 부분이 아닙니다.
<View android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?android:attr/listDivider"/>
여기 그것은 할 매우 간단 내 코드
<?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-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<include
layout="@layout/app_bar_main"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<android.support.design.widget.NavigationView
android:id="@+id/navigation_drawer_container"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start">
<android.support.design.widget.NavigationView
android:id="@+id/navigation_drawer_top"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="top"
android:background="@color/menuColor"
android:paddingLeft="50dp"
app:headerLayout="@layout/nav_header_main"
app:itemTextAppearance="@style/NavigationDrawerStyle"
app:itemTextColor="@color/menuTextColour"
app:menu="@menu/menu_navigation_drawer_top"
/>
<android.support.design.widget.NavigationView
android:id="@+id/navigation_drawer_bottom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/menuColor"
android:layout_gravity="bottom"
android:paddingLeft="50dp"
app:itemTextAppearance="@style/NavigationDrawerStyle"
app:itemTextColor="@color/menuTextColour"
app:menu="@menu/menu_navigation_drawer_bottom" />
</android.support.design.widget.NavigationView>
</android.support.v4.widget.DrawerLayout>
당신은 navigation_drawer_bottom의 레이아웃과 레이아웃의 상단에 디바이더를 작성해야 시도, 당신을위한
DividerItemDecoration
클래스입니다 .. 시도해보고 우려가있는 경우 알려주십시오 –http://stackoverflow.com/questions/30605286/navigationview-how-to-insert-divider-without-subgroup – user2025187