I have a sliding pane layout which contains a ListView
. I have a button to open the sliding pane. So I want to disable the swipe gesture for this sliding pane which is creating a problem when I am trying to access any other view in the same layout.
Is there anyway to only make the swipe gesture disabled and have the button functionality should work? It should open and close the sliding pane as usual on button click.
Below is part of my XML layout:
<android.support.v4.widget.SlidingPaneLayout
android:id="@+id/sliding_pane_layout_accountHome"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff" >
<LinearLayout
android:layout_width="280dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#FFFFFF">
<ListView
android:id="@+id/lv_menuList"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
</android.support.v4.widget.SlidingPaneLayout>
Here is code for button functionality
slidingLayout1 = (SlidingPaneLayout) findViewById(R.id.sliding_pane_layout_accountHome);
slidingLayout1.openPane();
iv_menu=(ImageView)findViewById(R.id.iv_menu);
iv_menu.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v)
{
if(slidingLayout1.isOpen()==true)
{
slidingLayout1.closePane();
}
else
{
slidingLayout1.openPane();
}
}
});