Hide ICS back home task switcher buttons

pinxue is spot-on… you want SYSTEM_UI_FLAG_HIDE_NAVIGATION. Example:

myView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);

One thing to note, though, is that upon any (and I mean ANY) user interaction the navigation bar will be reshown.

With Honeycomb the closest you can get is to go into “lights out” mode (now called “low profile”… SYSTEM_UI_FLAG_LOW_PROFILE ). This just makes the items on the navigation bar less visible (the little “dots” you’ve probably seen). If you want to do the best you can at maintain backwards compatibility with Honeycomb you can use reflection to use the “best” method:

// Ask the System Bar to hide
int whichHiddenStatusToUse = android.view.View.STATUS_BAR_HIDDEN;
try {
    // if this next line doesn't thrown an exception then we are on ICS or  
    // above, so we can use the new field.
    whichHiddenStatusToUse = View.class.getDeclaredField("SYSTEM_UI_FLAG_HIDE_NAVIGATION").getInt(mDrawingSurface);
} catch (Exception ex) {
}
// now lets actually ask one of our views to request the decreased visibility
myView.setSystemUiVisibility(whichHiddenStatusToUse);

Leave a Comment