【发布时间】:2017-08-20 14:17:22
【问题描述】:
我在这里使用的图标都是彩色的,但在运行时不会显示。 我在 xml 中尝试了 app:itemIconTint="@null",但没有用。
XML CODE:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item android:id="@+id/home"
android:title="@string/home"
android:icon="@drawable/icon_home"
app:itemIconTint="@null"/>
<item android:id="@+id/help"
android:title="@string/help"
android:icon="@drawable/icon_help"/>
</menu>
**这是另一个布局文件,幻灯片抽屉将出现。我删除了不必要的代码以使其变得简单**
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
........../>
</LinearLayout>
<android.support.v4.widget.DrawerLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.NavigationView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:menu="@menu/navigation"
android:layout_gravity="start">
</android.support.design.widget.NavigationView>
</android.support.v4.widget.DrawerLayout>
</RelativeLayout>
【问题讨论】:
-
你在使用 NavigationView @ Aryan 吗?
-
是的,我正在使用导航视图,我也在添加 XML 代码。
-
将此添加到您的活动@Aryan
标签: android xml material-design