简体   繁体   English

如何在导航抽屉中添加雪佛龙

[英]How to add chevron in navigation drawer

I am using navigation drawer in my app, i have a requirement to add chevron at the end of each row like following我在我的应用程序中使用导航抽屉,我需要在每一行的末尾添加 V 形,如下所示

在此处输入图片说明

Following is my code.以下是我的代码。

<com.google.android.material.navigation.NavigationView
    android:id="@+id/nav_view"
    android:fitsSystemWindows="true"
    android:layout_marginEnd="-65dp"
    android:layout_marginRight="-65dp"
    android:background="@color/nav_base_color"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    app:itemTextAppearance="@style/navigationFontStyle"
    app:headerLayout="@layout/nav_header_layout"
    app:menu="@menu/navigation" />
  <com.google.android.material.navigation.NavigationView
        android:id="@+id/nav_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:background="#fff"
        android:fitsSystemWindows="true"
        android:visibility="visible"
        app:headerLayout="@layout/nav_header_sample_drawer"
        app:itemIconTint="@color/colorPrimary"
        app:itemTextColor="#212121">

then here is nav_header_sample_drawe那么这里是 nav_header_sample_drawe

 <?xml version="1.0" encoding="utf-8"?>
 <layout xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:app="http://schemas.android.com/apk/res-auto">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/colorPrimary"
    android:orientation="vertical"
    android:paddingTop="20dp"
    android:theme="@style/ThemeOverlay.AppCompat.Dark">

    <include
        android:id="@+id/drawer_layout"
        layout="@layout/navigation_drawer"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_alignParentBottom="true" />


    </LinearLayout>
    </layout>

And Then in layout="@layout/navigation_drawer"然后在 layout="@layout/navigation_drawer"

you can add your custom layout您可以添加自定义布局

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM