Skip to content
Advertisement

MenuItem and toolbar missing in new activity Android Studio Unknown Bug

I am completely new to Android Studio and just learned Object-oriented programming. My project requires me to build something on open-source code. I added a new menu item to a menu and want to start another activity once the user clicks the menu item with id: plot. The intent will be sent from if (id == R.id.plot) within onOptionsItemSelected(MenuItem item) of TerminalFragment. For building activity_main2 with a menu, I followed a recipe on the internet to do it. I found out that the page of activity_main2 is blank (all black, no either toolbar or menu) when testing. What is missing with my code?

TerminalFragment

JavaScript

MainActivity2.java defines activity_main2.xml

JavaScript

activity_main2.xml

JavaScript

Advertisement

Answer

I think your Toolbar is pushed out of the screen by the layout_marginBottom = 675dp. If you want to show the Toolbar at top of the screen I would suggest this:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement