I created a full-screen Dialog using DialogFragment, as shown here. In my implementation, I created a Menu XML file to be called on the DialogFragment:
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<item
android:id="@+id/action_save"
android:orderInCategory="100"
android:title="Inserir"
app:showAsAction="always"/>
</menu>
The problem is that I would like to use a check/confirm icon instead of the default SAVE
message implied in Material Design, just like the one Telegram uses when trying to edit a group name (see below).
Is there a default icon in Android like this one in Telegram? How to change the text for the icon?
There is a standard checkmark image asset. To add it to your project, navigate to your res/drawable
directory in Android Studio and Right click -> New -> Image Asset
. In the wizard that opens, change "Icon Type" to "Action Bar and Tab Icons", then click on the "Clip Art" button to change the icon. Search for "check" and you'll find it.
To change the text to this new image, add the android:icon
attribute to your menu item, using the name you chose in the above wizard.
<item
android:id="@+id/action_save"
android:orderInCategory="100"
android:title="Inserir"
android:icon="@drawable/checkmark"
app:showAsAction="always"/>