SlidingDrawer抽屉效果想必大家都见过了,本文就是阐述了关于SlidingDrawer的抽屉效果讲解:
1.简介:
SlidingDrawer隐藏屏外的内容,并允许用户通过handle以显示隐藏内容。它可以垂直或水平滑动,它有俩个View组成,其一是可以拖动的handle,其二是隐藏内容的View.它里面的控件必须设置布局,在布局文件中必须指定handle和content.
案例:
<SlidingDrawer
android:id="@+id/sliding"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:content="@+id/allApps"
android:handle="@+id/imageViewIcon"
android:orientation="vertical" >
<Button
android:id="@+id/imageViewIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="本地"
android:textSize="18dp"
android:background="@drawable/btn_local" />
<GridView
android:id="@+id/allApps"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/file_list_bg"
android:columnWidth="60dp"
android:gravity="center"
android:horizontalSpacing="10dp"
android:numColumns="auto_fit"
android:padding="10dp"
android:stretchMode="columnWidth"
android:verticalSpacing="10dp" />
</SlidingDrawer>
2.重要属性
android:allowSingleTap:指示是否可以通过handle打开或关闭
android:animateOnClick:指示是否当使用者按下手柄打开/关闭时是否该有一个动画。
android:content:隐藏的内容
android:handle:handle(手柄)
3.重要方法
animateClose():关闭时实现动画。
close():即时关闭
getContent():获取内容
isMoving():指示SlidingDrawer是否在移动。
isOpened():指示SlidingDrawer是否已全部打开
lock():屏蔽触摸事件。