| 名稱 | JPSpringMenu |
|---|---|
| 語言 | Android |
| 平臺 | GitHub |
| 作者 | peng8350 |
| 鏈接 | 點此進(jìn)入 |
常規(guī)的安卓側(cè)滑菜單大家肯定見過,今天給大家推薦一款帶彈性的側(cè)滑菜單,話不多說,看效果圖。

效果圖
使用方法
- 添加依賴
dependencies {
compile 'com.jpeng:jpspringmenu:$latestVersion'
}
- 在Activity中添加
// R.layout.view_menu is your custom menu Layout resourceId
SpringMenu menu = new SpringMenu(this,R.layout.view_menu);
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
return menu.dispatchTouchEvent(ev);
}
- 配置menu
mSpringMenu.setMenuSpringConfig(SpringConfig.fromOrigamiTensionAndFriction(20,3));
mSpringMenu.setChildSpringConfig(SpringConfig.fromOrigamiTensionAndFriction(20, 5));
//opened CallBack
void onMenuOpen();
//closed CallBack
void onMenuClose();
/**
* When the menu is opening or closing,the method will call back(contain dragging arc)
* @value: 0f-2f,0f indicates that the menu is closed,2f indicates that opening
* @bouncing: this Boolean value is used to determine whether or not it is in bouncing,
* when in bouncing,The value is infinitely close to 2f,else is 0f
*/
void onProgressUpdate(float value,boolean bouncing);
//Content Page dark effect
setFadeEnable(boolean);
// distance of Allow the menu to begin dragging
setDragOffset(float);
setMenuListener(MenuListener);
setDirection(int direction);