-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
to better
- Loading branch information
Showing
3 changed files
with
50 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,48 @@ | ||
# SlidingMenu | ||
pattern QQ5.0 | ||
##简介 | ||
  这个工程是自己模仿QQ5.0侧滑菜单效果的实现,属于自定义的ViewGroup,主要是使用ViewDragHelper来实现ViewGroup中对子View的拖拽,并实现子View的伴随移动,需要考虑的细节较多 | ||
##使用帮助 | ||
   | ||
1.在布局使用自定义的SlidingMenu作为容器,添加两个子view(只能是2个不能多也不能少) | ||
|
||
<com.gpl.qqslidingmenu.view.SlidingMenu xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:id="@+id/slideMenu" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:background="@drawable/bg" | ||
tools:context=".MainActivity" > | ||
|
||
<include layout="@layout/layout_menu"/> | ||
<include layout="@layout/layout_main"/> | ||
</com.gpl.qqslidingmenu.view.SlidingMenu> | ||
|
||
2.在Activity中填充View初始化相关控件 | ||
|
||
... | ||
|
||
3.为slidingMenu添加监听器 | ||
|
||
slidingMenu.setOnDragStateChangeListener(new OnDragStateChangeListener() { | ||
@Override | ||
public void onOpen() { | ||
menu_listview.smoothScrollToPosition(new Random().nextInt(menu_listview.getCount())); | ||
} | ||
@Override | ||
public void onDrag(float fraction) { | ||
ViewHelper.setAlpha(iv_head, 1-fraction); | ||
} | ||
@Override | ||
public void onClose() { | ||
ViewPropertyAnimator.animate(iv_head).translationX(15) | ||
.setInterpolator(new CycleInterpolator(4)).setDuration(300).start(); | ||
} | ||
}); | ||
##实现效果 | ||
![Alt text](https://github.com/gplcn/SlidingMenu/raw/master/Screenshots/Screenshot01.gif) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters