Add action bar add button (#3)
This commit is contained in:
commit
dd4845c7e1
@ -1,6 +1,7 @@
|
||||
package com.example.myapplication
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.Menu
|
||||
import com.google.android.material.bottomnavigation.BottomNavigationView
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.navigation.findNavController
|
||||
@ -29,4 +30,9 @@ class MainActivity : AppCompatActivity() {
|
||||
setupActionBarWithNavController(navController, appBarConfiguration)
|
||||
navView.setupWithNavController(navController)
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
|
||||
menuInflater.inflate(R.menu.action_bar_menu, menu)
|
||||
return super.onCreateOptionsMenu(menu)
|
||||
}
|
||||
}
|
5
app/src/main/res/drawable/ic_add.xml
Normal file
5
app/src/main/res/drawable/ic_add.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
|
||||
</vector>
|
10
app/src/main/res/menu/action_bar_menu.xml
Normal file
10
app/src/main/res/menu/action_bar_menu.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
android:id="@+id/add"
|
||||
android:title="Add"
|
||||
android:icon="@drawable/ic_add"
|
||||
app:showAsAction="ifRoom" />
|
||||
</menu>
|
Loading…
Reference in New Issue
Block a user