Created
September 16, 2018 00:53
-
-
Save facilita-tecnologia/01057209de7615a6c4dbf5531597f930 to your computer and use it in GitHub Desktop.
Abrir Menu Android
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public boolean onCreateOptionsMenu(Menu menu) { | |
MenuInflater menuInflater = getMenuInflater(); | |
menuInflater.inflate(R.menu.menu, menu); | |
return true; | |
} | |
@Override | |
public boolean onOptionsItemSelected(MenuItem item) { | |
switch(item.getItemId()){ | |
case R.id.menuAbout: | |
Toast.makeText(this, "You clicked about", Toast.LENGTH_SHORT).show(); | |
break; | |
case R.id.menuSettings: | |
Toast.makeText(this, "You clicked settings", Toast.LENGTH_SHORT).show(); | |
break; | |
case R.id.menuLogout: | |
Toast.makeText(this, "You clicked logout", Toast.LENGTH_SHORT).show(); | |
break; | |
} | |
return true; | |
} | |
https://www.simplifiedcoding.net/android-toolbar-example/#Creating-Toolbar-Layout |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment