By default android have an option to enable BACK ARROW on the left of the toolbar using
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
same like i need TICK MARK on the right of the toolbar, is there any method to enable TICK MARK in android by default.
First download the "done" icon as png from the materials icon library
Copy the icons to your projects drawable folder.
Then create a file in res/menu called menu_example.xml
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_settings"
android:icon="@drawable/ic_done_white_24dp"
android:title="@string/action_done"
app:showAsAction="always" />
</menu>
Then add the following code to your Activity.
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_example, menu);
return true;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With