Skip to content

Instantly share code, notes, and snippets.

@facilita-tecnologia
Created September 16, 2018 00:53
Show Gist options
  • Save facilita-tecnologia/01057209de7615a6c4dbf5531597f930 to your computer and use it in GitHub Desktop.
Save facilita-tecnologia/01057209de7615a6c4dbf5531597f930 to your computer and use it in GitHub Desktop.
Abrir Menu Android
@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