【发布时间】:2020-10-13 16:48:01
【问题描述】:
我正在制作一个 Android 应用程序。我在里面使用了侧边导航抽屉,我没有看到抽屉里的彩色图标,但是我使用了彩色图标
我的 XML 代码是:
<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.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:context=".MainActivity"
tools:openDrawer="start">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" />
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@drawable/background_pic"
android:elevation="4dp"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
<FrameLayout
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<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:headerLayout="@layout/nav_header"
app:iconTint="@null"
app:menu="@menu/drawer_menu" />
</androidx.drawerlayout.widget.DrawerLayout>
【问题讨论】:
-
您将
app:iconTint设置为@null。您想将iconTint设置为您希望图标的颜色。 -
我的图标是多色的,我该怎么办?
-
您使用哪些视图来填充
NavigationView?
标签: android material-components-android material-components android-navigationview