[英]Image as an Icon for NavigationView Item
我希望使用全彩色圖像作為NavigationView中菜單項的圖標。 圖像需要大於標准圖標,並且沒有顏色。 (就像個人資料圖片一樣)我已經找到了兩種方法來更改圖標大小,但不能更改特定項目。 看來您必須更改全局私有屬性才能正常工作。 使用的是定義整個項目的app:actionLayout是我唯一的選擇嗎?
從Google的“日歷”應用中獲取,它可以准確顯示我在尋找什么。
不創建自定義抽屜,唯一的方法是添加標題布局(app:headerLayout):
<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:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header_main"
app:menu="@menu/activity_main_drawer"/>
如果您想要更可定制的導航抽屜,我建議您使用以下抽屜: https : //github.com/mikepenz/MaterialDrawer
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.