[英]How do I add two icons in individual items of Navigation Drawer
我們可以簡單地使用app:actionLayout並插入布局。 例如(導航抽屜的單個項):
<item
android:id="@+id/navId"
android:icon="@drawable/ic_ID"
android:title="Name"
app:actionLayout="@layout/layout"
/>
我使用了textview,並簡單地添加了帶有drawableRight的圖標
layout.xml
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:drawableLeft="@drawable/ic_two"
android:textAppearance="@style/TextAppearance.AppCompat.Body2" />
為此,您必須創建一個自定義布局並將其充氣到導航抽屜中。 那是選項一,第二個選項是創建帶有右側箭頭的背景圖像並在菜單中使用它
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.