How to show item icons on toolbar Android
11,016
you need to add this to your menu xml
xmlns:app="http://schemas.android.com/apk/res-auto"
then android:showAsAction="always"
should look like this
app:showAsAction="always"
final output would be something like this
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item android:id="@+id/bno_bookmark"
android:visible="true"
android:title="@string/disable_draw"
android:icon="@drawable/ic_pen"
app:showAsAction="always">
</item>
</menu>
Author by
Ever
Updated on June 04, 2022Comments
-
Ever almost 2 years
I am having some problems showing icons in the toolbar on Android It shows the string, but not the icon.
XML:
<item android:id="@+id/bno_bookmark" android:visible="true" android:title="@string/disable_draw" android:icon="@drawable/ic_pen" android:showAsAction="always"> </item>