aroSuv
aroSuv

Reputation: 137

Android disable Sliding Panel Layout on specific condition

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 .

Upvotes: 1

Views: 2334

Answers (2)

Mithun Sarker
Mithun Sarker

Reputation: 4023

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);
        }
    });                    
}

Upvotes: 1

J.D.
J.D.

Reputation: 1411

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);

Upvotes: -2

Related Questions