【问题标题】:change icon color to dark black in toolbar在工具栏中将图标颜色更改为深黑色
【发布时间】:2020-09-20 18:03:53
【问题描述】:

我想在工具栏中将图标颜色更改为黑色十六进制代码 #000000 我该怎么做

注意 showAsAction 设置为 allways 这是我的代码

工具栏:-

<androidx.appcompat.widget.Toolbar
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:id="@+id/tab_top"
            app:menu="@menu/top_navigation"
            android:layout_alignParentTop="true">

</androidx.appcompat.widget.Toolbar>

菜单:-

<?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/nav_following"
        android:icon="@drawable/ic_baseline_following_24"
        android:title=""
        android:enabled="true"
        app:showAsAction="always"
        android:iconTint="@android:color/black">

    </item>

</menu>

风格:-

<resources>
    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>
</resources>

here is the result im getting as we can see the icon is not black but it is dark grey

【问题讨论】:

    标签: android colors toolbar android-toolbar


    【解决方案1】:

    试试

    <androidx.appcompat.widget.Toolbar
        ...
        android:tint="@android:color/black"
    />
    

    【讨论】:

      猜你喜欢
      • 2019-03-11
      • 1970-01-01
      • 2010-09-20
      • 2021-08-30
      • 2021-07-19
      • 1970-01-01
      • 2017-07-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多