material-components / material-components/material-components-android

[Toolbar] navigationIconTint works differently in Android 5

Offen
#3,943 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

bug
Vorherrschende Sprache
Java
Sterne
17.4k
Forks
3.2k
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Start with MaterialToolbar navigationIconTint handling and the supplied layer-list navigation drawable, then reproduce the difference on Android API 21 and API 23 or later. Compare the rendered tint behavior with the issue’s screenshots; done means the navigation icon’s layered appearance is consistent with the expected behavior across the affected versions.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
android
Bereich
mobile
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.