Brian Fraser | App Bar (ActionBar/Toolbar): Android Programming @DrBFraser | Uploaded 3 years ago | Updated March 01 2023
Tutorial showing how to configure the App Bar (also called ActionBar or Toolbar). Docs: https://developer.android.com/training/appbar
1. setSupportActionBar() in onCreate()
2. Create now /res/menu/menu_xyz.xml
- setup any icons, IDs, and names in the xml
3. Show the menu via onCreateOptionsMenu()
4. Handle the menu clicks via onOptionsItemSelected()
5. Enable the left-arrow/back button (called 'up')
- in onCreate(): getSupportActionBar.setDisplayHomeAsUpEnabled(true);
- control its target via the manifest's android:parentActivityName property or
- control its action manually via android.R.id.home in onOptionsItemSelected()
Tutorial showing how to configure the App Bar (also called ActionBar or Toolbar). Docs: https://developer.android.com/training/appbar
1. setSupportActionBar() in onCreate()
2. Create now /res/menu/menu_xyz.xml
- setup any icons, IDs, and names in the xml
3. Show the menu via onCreateOptionsMenu()
4. Handle the menu clicks via onOptionsItemSelected()
5. Enable the left-arrow/back button (called 'up')
- in onCreate(): getSupportActionBar.setDisplayHomeAsUpEnabled(true);
- control its target via the manifest's android:parentActivityName property or
- control its action manually via android.R.id.home in onOptionsItemSelected()