I\'m trying to use Android ActionBar in my app, and have an option that\'s hidden away in the overflow menu.
There\'s a lot of documentation out there,
in manifest file declare
android:theme="@style/AppTheme.NoActionBar"
like this :
and add this to your style :
and call this in Activity onCreate() :
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
override this method in activity:
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.product_list, menu);
//U can find item set icon and stuff...
MenuItem item= menu.findItem(R.id.action_search);
return true;
}
and declare your menu like this for overflow menu:
and for handle item selection call this
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
switch (id) {
case R.id.sign_out:
//do stuff
break;
}
return super.onOptionsItemSelected(item);
}
done :)