Uploaded September 2020 | Updated September 2026, 2 weeks ago
Tutorial showing how to configure the App Bar (also called ActionBar or Toolbar). Docs: 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: 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()





![Working with Layouts: Android Programming
Guide to working with relative and linear layouts for the Android.
UI with Layout
* Relative: Able to put things relative to each other.
- Really easy to mess-up UI, so only use a little.
- Put things in corners or middle.
* Linear: Horizontal or vertical
+ +
| [Button] [Button] [Button] |
+ +
* Why use a Layout?
- Better scaling to new screen sizes.
Demo:
Relative layout:
1. Activity with a relative layout.
2. Place some text in corners and middle.
3. Have 3 elements one-over next
Linear Layout;
1. Activity with linear layout.
2. Place text one over next
Both:
1. Activity with relative layout.
2. Add linear horizontal layout (centered)
3. Add text
Nested:
1. To previous, add vertical linear layout.
2. Add items to it.
Advice: Planning Layouts
- Identify what elements are group together; put them in Linear layouts. Working with Layouts: Android Programming](https://i.ytimg.com/vi/xn9KYnwIoBE/mqdefault.jpg)




