Android滑出式菜单 SlidingMenu

openkk 12年前

SlidingMenu 是 Android 上实现类似 非死book 和 Path 2.0 滑动式菜单的组件。

Android滑出式菜单 SlidingMenu

使用方法:

<com.slidingmenu.lib.SlidingMenu      xmlns:sliding="http://schemas.android.com/apk/res-auto"      android:id="@+id/slidingmenulayout"      android:layout_width="fill_parent"      android:layout_height="fill_parent"      sliding:viewAbove="@layout/YOUR_ABOVE_VIEW"      sliding:viewBehind="@layout/YOUR_BEHIND_BEHIND"      sliding:touchModeAbove="margin|fullscreen"      sliding:touchModeBehind="margin|fullscreen"      sliding:behindOffset="@dimen/YOUR_OFFSET"      sliding:behindScrollScale="@dimen/YOUR_SCALE"      sliding:shadowDrawable="@drawable/YOUR_SHADOW"      sliding:shadowWidth="@dimen/YOUR_SHADOW_WIDTH" />
属性说明:
  • viewAbove - a reference to the layout that you want to use as the above view of the SlidingMenu
  • viewBehind - a reference to the layout that you want to use as the behind view of the SlidingMenu
  • touchModeAbove - an enum that designates what part of the screen is touchable when the above view is showing. Margin means only the left margin. Fullscreen means the entire screen. Default is margin.
  • touchModeBehind - an enum that designates what part of the screen is touchable when the behind view is showing. Margin means only what is showing of the above view. Fullscreen means the entire screen. Default is margin.
  • behindOffset - a dimension representing the number of pixels that you want the above view to show when the behind view is showing. Default is 0.
  • behindScrollScale - a float representing the relationship between the above view scrolling and the behind behind view scrolling. If set to 0.5f, the behind view will scroll 1px for every 2px that the above view scrolls. If set to 1.0f, the behind view will scroll 1px for every 1px that the above view scrolls. And if set to 0.0f, the behind view will never scroll; it will be static. This one is fun to play around with. Default is 0.25f.
  • shadowDrawable - a reference to a drawable to be used as a drop shadow from the above view onto the below view. Default is no shadow for now.
  • shadowWidth - a dimension representing the width of the shadow drawable. Default is 0.

项目主页:http://www.open-open.com/lib/view/home/1344906792819