I'm working with the ActionBarSherlock library and the Sliding Menu library for a Black Ops 2 guide application and've tryed to insert the beatiful "Overlay" function in the same activity of the Sliding Menu. The result is:
This is the code:
requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
super.onCreate(savedInstanceState);
setContentView(R.layout.c_m_pyrrhicvictory);
Resources res = getResources();
SlidingMenu menu = new SlidingMenu(this);
menu.setMode(SlidingMenu.LEFT);
menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
menu.setShadowWidthRes(R.dimen.shadow_width);
menu.setShadowDrawable(R.drawable.shadow);
menu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
menu.setFadeDegree(0.35f);
menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
menu.setMenu(R.layout.main_slidingmenu);
getActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setBackgroundDrawable(getResources().
getDrawable(R.drawable.ab_bg_black));
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setSubtitle("1/10 Standard");
getSupportActionBar().setTitle("Missions");
Screenshots: Main Activity SlidingMenu
I found solution. In file SlidingMenu.java find the function
public void attachToActivity(Activity activity, int slideStyle) {
attachToActivity(activity, slideStyle, false);
}
and change third parameter to true, attachToActivity(activity, slideStyle, true); i.e actionbarOverlay param should be set to true. It works for me. Don't forget to add topMargin or padding into the Menu layout, because the first list item may be hidden by ActionBar. See onLayout function in CustomViewBehind.java.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With