Android disable Sliding Panel Layout on specific condition

风格不统一 提交于 2019-12-11 10:24:31

问题


I am using AndroidSlidingUpPanel on my project . I want to disable sliding on specific condition . So that only top part is visible , and dragging is disabled .


回答1:


if(condition){
   mSlidingLayout.setEnabled(false);
   mSlidingLayout.setClickable(false);
}

if the above code doesn't work then try like

if(condition){
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
          mSlidingLayout.setEnabled(false);
          mSlidingLayout.setClickable(false);
        }
    });                    
}



回答2:


You can use

mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);

to lock your DrawerLayout so it won't be able to open with gestures. And unlock it with:

mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);



来源:https://stackoverflow.com/questions/36427681/android-disable-sliding-panel-layout-on-specific-condition

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!