android - Toolbar NavigationIcon 宽松主题

标签 android android-toolbar

根据我想要的 actionBar 颜色(深色或浅色),我为我的应用程序使用了两个主题: - Theme.AppCompat.Light.NoActionBar - Theme.AppCompat.NoActionBar

这是我的工具栏布局:

<android.support.v7.widget.Toolbar
    android:id="@+id/toolbar"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:minHeight="?attr/actionBarSize"
    app:theme="@style/ThemeOverlay.AppCompat.ActionBar"
    >

    <TextView
        android:id="@+id/toolbar_title"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:layout_gravity="center"
        android:maxLines="1"
        android:ellipsize="end"
        android:textAppearance="?android:attr/textAppearanceLarge"
        />

</android.support.v7.widget.Toolbar>

在我的 list 中,我将应用程序主题设置为浅色,并将一些 Activity 的属性主题设置为深色。

我发现我的工具栏有奇怪的行为。假设我在一个带有白色工具栏的 Activity 中(该 Activity 使用浅色主题)并且我导航到一个带有红色工具栏(具有深色主题)的 Activity 。当我回到带有白色工具栏的 Activity 时,导航图标(向左的箭头)现在是白色的。就像它带走了我的黑暗主题。

希望我把情况解释清楚。

谢谢!

最佳答案

编辑 已在支持库 v22.0.0 中修复

最后,我发现这是 appCompat 中的一个错误。它是固定的,但仍未合并/发布。

https://code.google.com/p/android/issues/detail?id=78289

关于android - Toolbar NavigationIcon 宽松主题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26808917/

相关文章:

android - 从另一个 Activity 返回时 SurfaceView 崩溃

android - RecyclerView 或 ListView 的 Jetpack Compose 是什么?

Android Theme 样式文件合并

java - Android:如何让 SearchView 关闭按钮返回 setQueryHint()?

java - RSS 应用程序,我的 ListView 出现问题

android - Google Play 服务实时多人游戏的共享种子?

android - getSupportActionBar 可以在 setSupportActionBar 之后立即为 null 吗?

Android Activity 工具栏向上按钮不显示

Android:工具栏文本显示为黑色而不是白色

android - webview 占据整个屏幕,覆盖工具栏