Wednesday, 19 June 2019

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



from Androidx Navigation icon compatability issues in Android 7

No comments:

Post a Comment