In this video we will create an options menu in Android Studio, which contains icons, drop down menus and sub items. The menu will be displayed in the app bar. For this we will override onCreateOptionsMenu and pass our own menu.xml file. Also we will handle click events on the single items in the onOptionsItemSelected method.

Example code for this video:

____________________
❗ Subscribe to the channel:

⏯ Watch more tutorials:

⭐ Become a channel member for exclusive tutorials and other perks:

㊙ Help translating the videos:

💚 Support the content:

💬 Join the Discord chat:

🎧 Audiobooks and podcasts for programmers:

👶 How to get started with Android development:

📣 Follow Coding in Flow on social media:

Facebook:

Instagram:

Twitter:

Blog:

Nguồn:https://u-os.org/

Xem Thêm Bài Viết Khác:https://u-os.org/cong-nghe

Author

24 Comments

  1. Coding in Flow Reply

    * * *
    I added a link to the code for this video into the description box!
    * * *

  2. Ahmed Alnuaimy Reply

    how to remove title of submenu item on right side option menu?

  3. Hello. Is it possible to ask on how you can combine the tic tac toe game with the options menu? Thank you.

  4. Troll Berserker Reply

    Do you have a tutorial where you use such menu to switch between fragments?

  5. Yousef Nashef Reply

    at 6:00 why does adding break; after each case and at the end of the function returning true does not work?

  6. Tashila Pathum Reply

    You. are. awesome.
    Every video is perfect! Keep up the good work

  7. Ahmed Alnuaimy Reply

    how to hide the title after i open subitem of the other menu in that item??

  8. Roosevelt Abandy Reply

    even in 2019 youre the best, i code on flutter, just wanted to see android and its like i'm a genius. Thanks

  9. uchihasurvival Reply

    How do I prevent it from displaying the app's name? Also, why does the toolbar move when it transitions to a new activity? Why isn't it's animation static?

  10. Agus Contreras Reply

    Hey! I don't know why I can't see my menu in the activity! What can I do? Do I have to change anything in the xml? I'm dead

  11. Oleg Korchagin Reply

    Thank you! You explained very simply and affordably!

  12. Much appreciated man. This helped me finish my final project in Mobile App class! Thank you for spreading your knowledge of Android Studio 🙂

  13. I.T Bro Bangla Reply

    Thanks a lot !! This make
    my project so much great !!!

Write A Comment