Add new action bar demos:
- Buttons for showing/hiding action bar and system UI in the basic action bar demo. - New system UI demo that uses a non-overlay action bar. Change-Id: Id3fbaa77365476489c558a2a43855a01f383551c
This commit is contained in:
@@ -46,6 +46,8 @@ public class ActionBarDisplayOptions extends Activity
|
||||
findViewById(R.id.toggle_show_custom).setOnClickListener(this);
|
||||
findViewById(R.id.toggle_navigation).setOnClickListener(this);
|
||||
findViewById(R.id.cycle_custom_gravity).setOnClickListener(this);
|
||||
findViewById(R.id.toggle_visibility).setOnClickListener(this);
|
||||
findViewById(R.id.toggle_system_ui).setOnClickListener(this);
|
||||
|
||||
mCustomView = getLayoutInflater().inflate(R.layout.action_bar_display_options_custom, null);
|
||||
// Configure several action bar elements that will be toggled by display options.
|
||||
@@ -107,6 +109,22 @@ public class ActionBarDisplayOptions extends Activity
|
||||
lp.gravity = lp.gravity & ~Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK | newGravity;
|
||||
bar.setCustomView(mCustomView, lp);
|
||||
return;
|
||||
case R.id.toggle_visibility:
|
||||
if (bar.isShowing()) {
|
||||
bar.hide();
|
||||
} else {
|
||||
bar.show();
|
||||
}
|
||||
return;
|
||||
case R.id.toggle_system_ui:
|
||||
if ((getWindow().getDecorView().getSystemUiVisibility()
|
||||
& View.SYSTEM_UI_FLAG_FULLSCREEN) != 0) {
|
||||
getWindow().getDecorView().setSystemUiVisibility(0);
|
||||
} else {
|
||||
getWindow().getDecorView().setSystemUiVisibility(
|
||||
View.SYSTEM_UI_FLAG_FULLSCREEN);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
int change = bar.getDisplayOptions() ^ flags;
|
||||
|
||||
Reference in New Issue
Block a user