I made my own button design in drawable and assigned it to app:navigationIcon
. It showed up nicely under the design view but when I ran my app the default menu icon was shown. Is there any way to solve this problem?
Below is my code for the toolbar:
<androidx.appcompat.widget.Toolbar
android:id="@+id/dash_toolBar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:elevation="5dp"
android:background="@android:color/transparent"
android:minHeight="?android:attr/actionBarSize"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:navigationIcon="@drawable/ic_menu" />
Below is my code for ic_menu
icon:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:gravity="fill"
android:drawable="@drawable/ic_circle_red"
/>
<item
android:gravity="center"
android:drawable="@drawable/ic_menu_red"
android:top="8dp"
android:bottom="8dp"
android:left="8dp"
android:right="8dp"
/>
</layer-list>
Below is the code for the circle:
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="#FF5252"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M12,12m-10,0a10,10 0,1 1,20 0a10,10 0,1 1,-20 0" />
</vector>
Below is the code for the menu:
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#ffffff"
android:pathData="M3,18h18v-2L3,16v2zM3,13h18v-2L3,11v2zM3,6v2h18L21,6L3,6z"/>
</vector>