Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Androidx Navigation icon compatability issues in Android 7

I am using com.google.android.material.appbar.AppBarLayout along with androidx.appcompat.widget.Toolbar in my app and in Android 8 it works perfectly but I am having an issue where the 'hamburger' menu icon and 'back' icons are just displaying as a white block in android 7 (API 24 & API 25) even though other menu icons are displayed correctly.

Where the hamburger icon is showing.

where the hamburger icon looks like

And what the back button looks like.

what the back button looks like

My app bar layout:

<com.google.android.material.appbar.AppBarLayout
        android:id="@+id/activity_drawer_layout_app_bar_layout"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize">

        <androidx.appcompat.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary" />

    </com.google.android.material.appbar.AppBarLayout>

And just setting up the toolbar:

setSupportActionBar ( toolbar )

    actionBar?.setDisplayShowCustomEnabled(true)
    actionBar?.setDisplayShowCustomEnabled(true)
    actionBar?.setDisplayHomeAsUpEnabled(true)
    actionBar?.setDisplayShowHomeEnabled(true)
    actionBar?.setDisplayShowTitleEnabled(true)
like image 741
letterman549 Avatar asked Aug 14 '26 15:08

letterman549


1 Answers

As you are using Material library this is the expected result. I don't know how the compiler in Android 8 override the material theme settings by default. If you use material library color tints are by default applied. For more details have a look at https://material.io/design/color/applying-color-to-ui.html#usage.
You will learn everything about Material library at that website.

like image 172
Vanshaj Daga Avatar answered Aug 17 '26 07:08

Vanshaj Daga



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!