android - 如何更改 kotlin 中的图标颜色?
问题描述
<?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:openDrawer="start">
<include
layout="@layout/app_bar_main"
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"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header_main"
app:itemIconTint= ""
app:menu="@menu/activity_main_drawer" />
</androidx.drawerlayout.widget.DrawerLayout>
这些图标有它们原来的颜色。
但是,如果设置为 itemIconTint = "@null",则颜色变为灰色。
如果你删除@null,颜色会很好,但它不会被构建。
我是初学者。我应该怎么办?
我想让它变成这样。->在此处输入图像描述
解决方案
通过阅读您所做的评论,我了解您不想更改图标的颜色。如果是这样,据我所知,根本不需要设置app:itemIconTint
,它不是NavigationView
. 你试过删除那条线吗?
推荐阅读
- python - 关于模块属性的 python 类型提示(如模块协议)
- regex - 使用正则表达式从数据中提取文本
- javascript - 打开模式时防止在正文上滚动导致页面自动转到顶部
- javascript - 通过javascript使用级联下拉菜单时初始化子按钮
- c++ - PCL::RegionGrowing 负指数
- postgresql - 将超时设置为 Postgres 服务 pg_ctl
- mongodb - 在 mongo 聚合查询中获取值百分比
- firebase - 我一直在尝试从我的用户配置文件中的 firebase Firestore 获取用户数据正在使用颤振我需要帮助,用户数据存储在数据库中
- ansible - 奇怪的 Ansible 问题
- c# - 水晶报表 64 位