Elyar的Android笔记(七):Android侧滑菜单
2015-03-28 18:45
253 查看
Elyar的Android笔记(七):Android侧滑菜单
转载前请注明出处,尊重版权:http://blog.csdn.net/u012418084首先明确几点内容:
实现侧滑需要使用:DrawerLayout,它在android.support.v4.widget包中
主布局容器:用来显示主要的布局内容
侧滑菜单容器:用来存放侧滑菜单中的子View
DrawerLayout中包含两个子元素,第一个为主布局中显示的内容,第二个为侧滑菜单中显示的内容
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
(1)<include layout="@layout/XXXX" />
//包含主布局显示内容
</LinearLayout>
<LinearLayout
android:layout_width="240dp"
android:layout_height="match_parent"
(2)android:layout_gravity="start|right|">
<include layout="@layout/XXXX" />
//包含侧滑菜单显示内容
</LinearLayout>
</android.support.v4.widget.DrawerLayout>
注:(1)如果主布局内容和侧滑菜单内容复杂,那么可以以include的方式引入到各自相应的布局中
(2)android:layout_gravity该属性决定侧滑菜单从哪个方向滑出:start或left为从左侧滑出end或right为从右侧滑出
完成以上步骤可以实现滑动了
=====================================================================================================================================================
相关文章推荐
- [学习笔记]用户界面优化之Android侧滑菜单(DrawerLayout使用)
- Android笔记:如何写出一个侧滑菜单
- Android 高仿 QQ5.0 侧滑菜单效果 自定义控件来袭【学习鸿洋_视频博客笔记总结】
- Android笔记(五十二) 侧滑菜单SlidingMenu
- android侧滑菜单笔记
- Android笔记——Drawerlayout创建侧滑出菜单
- Android笔记——Drawerlayout创建侧滑出菜单
- Android笔记——Drawerlayout创建侧滑出菜单
- Android侧滑菜单之DrawerLayout用法详解
- android 应用架构随笔五(ActionBar与侧滑菜单DrawerLayout)
- Android仿人人客户端滑动菜单的侧滑菜单效果
- Android之 利用DrawerLayout打造一个侧滑菜单
- Android 实现形态各异的双向侧滑菜单 自定义控件来袭
- android官方侧滑菜单DrawerLayout详解
- 实习笔记:侧滑菜单的小轮子-纯粹的侧滑菜单slidebar-摩拜单车类似
- Android官方侧滑菜单
- android菜单学习笔记
- 仿Android 5.0 侧滑菜单按钮动画 以及侧滑菜单联动
- Android中侧滑菜单的实现
- 慕课学习笔记之侧滑菜单的实现