I am looking to hide the Sherlock action bar on single tap and show it when user does another single tap thus showing/hiding on alternating single tap.
The code for showing and hiding is:
@Override
public boolean onSingleTapConfirmed(MotionEvent e) {
ActionBar actionBar = getSupportActionBar();
if (actionBar.isShowing()) {
actionBar.hide();
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN);
} else {
actionBar.show();
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
return super.onSingleTapConfirmed(e);
}
The above code works fine for me but the problem is the jerk seen by the user when the transition od action and notification bars occurs from shown to hidden and vice versa.
To avoid the jerk, I added the following line in the onCreate method, but it causes the action bar to cover the UI elements when the action bar comes to visible from invisible state.
requestWindowFeature(com.actionbarsherlock.view.Window.FEATURE_ACTION_BAR_OVERLAY);
Is there any way out by which the jerk is also not there and the action bar is not overlayed on the UI elements when it comes from hidden to visible state?
How about achieving the similar behavior with a sliding menu from top? you could set roatation to SlidingDrawer and use it
android:rotation="180" // in SlidingDrawer manifest tag.
I understand that SlidingDrawer is deprecated in API 17 but you could always have a custom implementation of this. I'm sure this would be a very smooth implementation for you.