帶彈性的側(cè)滑菜單

名稱 JPSpringMenu
語言 Android
平臺 GitHub
作者 peng8350
鏈接 點此進(jìn)入

常規(guī)的安卓側(cè)滑菜單大家肯定見過,今天給大家推薦一款帶彈性的側(cè)滑菜單,話不多說,看效果圖。


效果圖

使用方法

  1. 添加依賴
dependencies {
    compile 'com.jpeng:jpspringmenu:$latestVersion'
}
  1. 在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); 
}
  1. 配置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);
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容