SlidingMenu侧滑简单实现
2017-04-16 18:28
162 查看
建立一个空的xml布局文件,布局里用FrameLayout给FrameLayout一个ID id是(红色字体部分)添加空的布局是黄色字体部分
写在方法内方法名自拟
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/menu_frame" android:layout_width="match_parent" android:layout_height="match_parent" />
在建立一个xml布局,内写入你想要侧滑内的布局
在建立一个类继承Fragment 在下面方法中实例化一个对象(蓝色字体部分)
写在方法内方法名自拟
setBehindContentView(R.layout.menu_frame_left); MenuLeftFragment menuLeftFragment = new MenuLeftFragment(); int commit = getSupportFragmentManager().beginTransaction() .replace(R.id.menu_frame, menuLeftFragment).commit(); int mWidthPixels = this.getResources().getDisplayMetrics().widthPixels; // 实例化滑动菜单对象 mMenu = getSlidingMenu(); // 设置可以左右滑动的菜单 mMenu.setMode(SlidingMenu.LEFT); // 设置滑动菜单视图的宽度 mMenu.setBehindWidth(mWidthPixels /4*3); // 设置渐入渐出效果的值 mMenu.setFadeDegree(0.35f); // 设置触摸屏幕的模式,这里设置为全屏 mMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN); // 设置下方视图的在滚动时的缩放比例 mMenu.setBehindScrollScale(0.0f);
相关文章推荐
- Android 侧滑菜单的简单实现(SlidingMenu)二
- Android 侧滑菜单的简单实现(SlidingMenu)
- android之SlidingMenu简单实现侧滑菜单
- Android 侧滑菜单实现(SlidingMenu)
- 【Android界面实现】SlidingMenu实现侧滑栏效果
- Android滑动菜单特效实现,仿人人客户端侧滑效果,史上最简单的侧滑实现
- Android滑动菜单特效实现,仿人人客户端侧滑效果,史上最简单的侧滑实现
- 使用开源组件slidingmenu_library来模拟实现人人客户端的主页侧滑界面
- Android滑动菜单特效实现,仿人人客户端侧滑效果,史上最简单的侧滑实现
- Android滑动菜单特效实现,仿人人客户端侧滑效果,史上最简单的侧滑实现
- 【Android进阶】SlidingMenu实现侧滑栏效果的实现
- Android滑动菜单特效实现,仿人人客户端侧滑效果,史上最简单的侧滑实现
- Android滑动菜单特效实现,仿人人客户端侧滑效果,史上最简单的侧滑实现
- 滑动菜单栏slidingmenu,实现简单例子,UI学习之路三
- Android滑动菜单特效实现,仿人人客户端侧滑效果,史上最简单的侧滑实现
- Android滑动菜单特效实现,仿人人客户端侧滑效果,史上最简单的侧滑实现
- 使用开源组件slidingmenu_library来模拟实现人人客户端的主页侧滑界面
- Android滑动菜单特效实现,仿人人客户端侧滑效果,史上最简单的侧滑实现
- Android滑动菜单特效实现,仿人人客户端侧滑效果,史上最简单的侧滑实现
- 使用开源组件slidingmenu_library来模拟实现人人客户端的主页侧滑界面