Android SlidingDrawer使用
来源:互联网 发布:用手机听小说的软件 编辑:程序博客网 时间:2024/05/01 22:26
【JunTao_sun】博客
SlidingDrawer是自SDK 1.5才新加入的,实现Launcher的抽屉效果。
<RelativeLayout 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" android:background="@drawable/skin" > <SlidingDrawer android:id="@+id/slidingdrawer" android:layout_width="wrap_content" android:layout_height="fill_parent" android:content="@+id/contents" android:handle="@+id/handle" android:orientation="vertical" > <ImageView android:id="@+id/handle" android:layout_width="40dp" android:layout_height="40dp" android:background="@drawable/ic_tip" /> <LinearLayout android:id="@+id/contents" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/ic_jl" > <Button android:id="@+id/btn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button" /> <EditText android:id="@+id/editText" android:layout_width="fill_parent" android:layout_height="wrap_content" /> </LinearLayout> </SlidingDrawer></RelativeLayout>
android:handle="@+id/handle"
控制SlidingDrawer的打开和隐藏 与布局里的开关控件 imageview 也可以是button 对应相同的ID handle.
android:content="@+id/contents"
指明展开的Layout Content 的 id。
android:orientation="horizontal" 水平显示
android:orientation="vertical" 垂直显示
设置打开抽屉的监听事件
setOnDrawerOpenListener
设置关闭抽屉的监听事件
setOnDrawerCloseListener
设置滚动监听
setOnDrawerScrollListener
重要的方法:
animateClose():关闭时实现动画。
close():即时关闭
getContent():获取内容
isMoving():指示SlidingDrawer是否在移动。
isOpened():指示SlidingDrawer是否已全部打开
lock():屏蔽触摸事件。
setOnDrawerCloseListener(SlidingDrawer.OnDrawerCloseListener onDrawerCloseListener):SlidingDrawer关闭时调用
unlock():解除屏蔽触摸事件。
toggle():切换打开和关闭的抽屉SlidingDrawer。
0 0
- Android 怎么样使用SlidingDrawer
- android SlidingDrawer 使用注意
- Android SlidingDrawer使用
- Android 控件使用之SlidingDrawer
- Android 控件使用之SlidingDrawer
- Android--SlidingDrawer的使用介绍
- Android:SlidingDrawer
- Android Launcher抽屉类SlidingDrawer的使用
- Android Launcher抽屉类SlidingDrawer的使用!
- Android Launcher抽屉类SlidingDrawer的使用!
- Android Launcher抽屉类SlidingDrawer的使用
- Android 抽屉类SlidingDrawer的使用
- Android 抽屉类SlidingDrawer的使用
- Android 抽屉类SlidingDrawer的使用
- Android Launcher抽屉类SlidingDrawer的使用
- Android Launcher抽屉类SlidingDrawer的使用!
- android的抽屉控件SlidingDrawer的使用
- Android中抽屉(SlidingDrawer)的使用介绍及实例记录
- 在xcode6.1和ios10.10.1环境下实现真机测试
- 南大软院大神养成计划--day18
- EventBus---使用
- 快速点击Altdialog多下弹出多个dialog问题
- Jquery_artDialog对话框弹出
- Android SlidingDrawer使用
- 1025解题--学习
- android View 事件分发
- 俞敏洪老师2014年底写的
- LOG 调试中的V、D、I、W、E
- ListView滑动到底部加载数据
- python与BeautifulSouop计算SUMO仿真的到达速率
- LeetCode解题报告-- Count and Say
- JS获取浏览器窗口大小 获取屏幕,浏览器,网页高度宽度