кастомный айтем Material NavigationView

Делаю кастомный item для NavigationView от Material Design

Прописываю в menu

   <item
   android:id="@+id/button"
   android:actionLayout="@layout/item_button"
   android:title="" />

В layout NavigationView имеет такой вид

<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"
      app:itemIconPadding="16dp"
      android:fitsSystemWindows="true"
      app:headerLayout="@layout/nav_header_main"
      app:menu="@menu/main_drawer" />

Но на месте где должен быть кастомный айтем, там просто пустота.

layout айтема

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">
    <TextView
        android:id="@+id/text"
        android:textColor="@android:color/black"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="dsadsasdasad"/>
</LinearLayout>

Как сделать тогда кастомный айтем?


Ответы (0 шт):