工具栏NavigationIcon宽松主题宽松、工具栏、主题、NavigationIcon

2023-09-07 22:34:34 作者:倾城一夜雪

我使用的不同颜色的ActionBar我想(或深或浅的颜色)的我的应用程序两个主题: - Theme.AppCompat.Light.NoActionBar - Theme.AppCompat.NoActionBar

I use two themes for my app depending of the actionBar color I want (dark or light color) : - Theme.AppCompat.Light.NoActionBar - Theme.AppCompat.NoActionBar

下面是我的工具栏布局:

Here's my toolbar layout :

<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>

在我的表现,我设置了应用主题灯和一些活动有属性设置主题为暗。

In my manifest, I set the Application theme to light and some activities have the attribute theme set as dark.

我看到我的工具栏一个怪异的行为。比方说,我在白色的工具栏(活动使用灯光主题)的活动,我浏览到与Red工具栏的活动(即有黑暗的主题)。当我回来的白工具栏的活性,导航图标(左箭头)现在是白色。喜欢它拿走了我黑暗的主题。

I see a weird behaviour with my toolbar. Let's say I'm in an activity with white toolbar (the activity use the light theme) and i navigate to an activity with Red toolbar (that has the dark theme). When I come back to the activity with the white toolbar, the navigation icon (the left pointing arrow) is now white. Like it has taken my dark theme.

希望我解释清楚的情况。

Hope I explained the situation clearly.

感谢您!

推荐答案

修改修正了支持库v22.0.0

EDIT Fixed in Support Library v22.0.0

最后,我发现它是在应用程序兼容性的错误。它是固定的,但仍然没有合并/发表。

Finally, I found out it is a bug in appCompat. It is fixed, but still not merged/released.

HTTPS://$c$c.google。 COM / p /安卓/问题/细节?ID = 78289