可以实现的代码
// configure the SlidingMenu
menu = new SlidingMenu(this);
menu.setMode(SlidingMenu.LEFT);
// 设置触摸屏幕的模式
menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
menu.setShadowWidthRes(R.dimen.shadow_width);
menu.setShadowDrawable(R.color.mgr_common_yellow);
// 设置滑动菜单视图的宽度
menu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
// 设置渐入渐出效果的值
menu.setFadeDegree(0.35f);
/**
* SLIDING_WINDOW will include the Title/ActionBar in the content
* section of the SlidingMenu, while SLIDING_CONTENT does not.
*/
menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
//为侧滑菜单设置布局
menu.setMenu(R.layout.slidemeun);
menu.addIgnoredView(mViewPager);
menu.setOnOpenListener(new SlidingMenu.OnOpenListener() {
@Override
public void onOpen() {
testBtn.setVisibility(View.INVISIBLE);
}
});
menu.setOnCloseListener(new SlidingMenu.OnCloseListener() {
@Override
public void onClose() {
testBtn.setVisibility(View.VISIBLE);
}
});
<!--sliding menu--> <dimen name="slidingmenu_offset">60dp</dimen> <dimen name="shadow_width">15dp</dimen>