First of all set activty theme to NoActionBar
.
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
Then create a Toolbar
in XML and set layout_alignParentBottom
true.
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:minHeight="?attr/actionBarSize">
Then in onCreate
catch the Toolbar and set as ActionBar
mToolbar = (Toolbar) findViewById(R.id.homeToolbar);
setSupportActionBar(mToolbar);
Create a menu file in res/menu
folder
Then inflate that menu in onCreateOptionsMenu
.
Then override onOptionsItemSelected
and do what you want with the items.