名称 | JPSpringMenu |
---|---|
语言 | Android |
平台 | GitHub |
作者 | peng8350 |
链接 | 点此进入 |
常规的安卓侧滑菜单大家肯定见过,今天给大家推荐一款带弹性的侧滑菜单,话不多说,看效果图。
效果图
使用方法
- 添加依赖
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);
网友评论