Reputation: 1581
So the problem i have is that when the panel slides up and i touch somewhere it closes the panel.
How can i disable touch so that i can only drag the panel to open and close it?
This is the library: https://github.com/umano/AndroidSlidingUpPanel
Thanks,
Vince
Upvotes: 2
Views: 833
Reputation: 1581
I found a solution,i'm not sure if this is how it's done but it works.
This disables touch for the whole slide panel
mSlideUpPanel.getChildAt(1).setOnClickListener(null);
mBottomSheet is the dragview you drag up to show the panel.
If you want you can just add an onclicklistener to the dragview so you can also click on the bottomsheet to open/close it.
mBottomSheet.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (mSlideUpPanel != null &&
(mSlideUpPanel.getPanelState() == SlidingUpPanelLayout.PanelState.COLLAPSED || mSlideUpPanel.getPanelState() == SlidingUpPanelLayout.PanelState.ANCHORED)) {
mSlideUpPanel.setPanelState(SlidingUpPanelLayout.PanelState.EXPANDED);
}
if (mSlideUpPanel != null &&
(mSlideUpPanel.getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED || mSlideUpPanel.getPanelState() == SlidingUpPanelLayout.PanelState.ANCHORED)) {
mSlideUpPanel.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
}
}
});
Upvotes: 1