【问题标题】:Change overflow and home icon color in android在android中更改溢出和主页图标颜色
【发布时间】:2015-10-08 08:38:23
【问题描述】:

我正在开发一个最低 API 级别 10 (2.3.3) 的 android 应用程序,并且我使用工具栏作为我的操作栏。主页图标和溢出图标以及标题文本颜色在 Honeycomb 和上面都是白色的,这就是我想要的。问题出在蜂窝下方,主页图标、溢出图标和标题颜色是黑色的,我希望它们也是白色的。我该怎么做。下面是我的代码。

styles.xml

<style name="Theme.DesignDemo" parent="Base.Theme.DesignDemo">
</style>

<style name="Base.Theme.DesignDemo" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="colorPrimary">@color/primary</item>
    <item name="colorPrimaryDark">@color/primaryDark</item>
    <item name="colorAccent">@color/accent</item>
    <item name="android:windowBackground">@color/window_background</item>
    <item name="android:windowAnimationStyle">@style/MyAwesomeAnimation</item>
</style>

工具栏

<android.support.design.widget.AppBarLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

<android.support.v7.widget.Toolbar
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    android:background="?attr/colorPrimary"
    app:layout_scrollFlags="scroll|enterAlways"
    app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

【问题讨论】:

  • 你最后解决了这个问题吗?

标签: android android-actionbar toolbar


【解决方案1】:

我遇到了完全相同的问题。在 API 级别 11 及更低级别中,溢出和 homeAsUp 图标都是黑色的。应用程序主题中的以下附加行解决了问题

<item name="android:textColorSecondary">@android:color/white</item>

另见AppCompat Toolbar: Change Overflow Icon Color in ActionMode

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-03-15
    • 1970-01-01
    • 2015-04-21
    • 1970-01-01
    • 2017-07-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多