Question

i'm using a DoubleDrawer Layout. One Drawer from the Left and one from the right. In the left Drawer i have some Navigation stuff. On the right Drawer i have some detail Information.

I wan't to lock the right Drawer from opening the drawer by the user when swiping from the right edge to left.

Here is a stripped down version from my XML:

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<!-- Main Content -->

<FrameLayout
    android:id="@+id/content_frame"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/main_bkgnd"
    android:choiceMode="singleChoice"
    android:divider="@color/transparent"
    android:dividerHeight="@dimen/zero"
    android:paddingLeft="@dimen/main.padding"
    android:paddingRight="@dimen/main.padding" >

    <!-- Some other elements -->

</FrameLayout>

<!-- Menü -->

<FrameLayout
    android:id="@+id/menu_drawer"
    android:layout_width="@dimen/menu.width"
    android:layout_height="fill_parent"
    android:layout_gravity="start"
    android:background="@color/drawer_bkgnd"
    android:choiceMode="singleChoice"
    android:divider="@color/list_divider"
    android:dividerHeight="@dimen/zero"
    android:paddingLeft="@dimen/menu.padding"
    android:paddingRight="@dimen/menu.padding" >

    <!-- Some other elements -->

</FrameLayout>

<!-- Detailansicht -->

<ScrollView
    android:id="@+id/detail_drawer"
    android:layout_width="@dimen/detail.width"
        android:layout_height="fill_parent"
        android:layout_gravity="end"
        android:background="@color/drawer_bkgnd"
        android:paddingLeft="@dimen/detail.padding"
        android:paddingRight="@dimen/detail.padding" >

    <RelativeLayout    
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" >

        <!-- Some other elements -->

    </RelativeLayout>
</ScrollView>

Was it helpful?

Solution

Set the drawer mode to LOCK_MODE_LOCKED_CLOSED.
The drawer is locked closed. The user may not open it, though the app may open it programmatically.

public void setDrawerLockMode (int lockMode, int edgeGravity)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top