Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Toolbar] navigationIconTint works differently in Android 5 #3943

Open
ArcherEmiya05 opened this issue Dec 20, 2023 · 0 comments
Open

[Toolbar] navigationIconTint works differently in Android 5 #3943

ArcherEmiya05 opened this issue Dec 20, 2023 · 0 comments
Labels

Comments

@ArcherEmiya05
Copy link

ArcherEmiya05 commented Dec 20, 2023

Description: Full description of issue here

Expected behavior:

In Android 5 the tint only affects certain layer which is our preferred behavior
image

In Android 6 and above the tint changes the whole color of navigation icon
image

Source code:
This is the drawable of navigation icon which uses layer and resource qualifier of day and night.

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape android:shape="oval">
            <solid android:color="?attr/colorPrimary"/> // Dynamic day and night color
        </shape>
    </item>
    <item android:drawable="?attr/homeAsUpIndicator"/>
</layer-list>

Toolbar

<com.google.android.material.appbar.MaterialToolbar
   android:id="@+id/toolbar"
   android:layout_width="match_parent"
   android:layout_height="?attr/actionBarSize"
   app:navigationIcon="@drawable/ic_back_circled"
   app:navigationContentDescription="@string/abc_action_bar_up_description"
   app:layout_collapseMode="pin"
   app:layout_scrollFlags="scroll|snap|enterAlways|enterAlwaysCollapsed"
   app:title="@string/vwap" />

Theme

<!-- Toolbar style inside CollapsingToolbar on both light and night mode -->
   <style name="AppToolbarForCollapsing" parent="Widget.Material3.Toolbar" tools:keep="@style/AppToolbarForCollapsing">
       <item name="android:paddingStart">0dp</item>
       <item name="android:paddingEnd">20dp</item>
       <item name="contentInsetStart">0dp</item>
       <item name="contentInsetEnd">0dp</item>
       <item name="contentInsetStartWithNavigation">0dp</item>
       <item name="navigationIconTint">@color/colorPrimaryDark_White</item>
   </style>

Usage

<!-- Activity theme for CollapsingToolbarLayout -->
    <style name="Theme.App.NoActionBar.TranslucentStatusBar">
        <item name="android:windowTranslucentStatus">true</item>
        <item name="toolbarStyle">@style/AppToolbarForCollapsing</item>
    </style>

Android API version: 5

Material Library version: 1.11.0

Device: Pixel emulator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant