Search code examples
androidscrollviewandroid-scrollviewdrawerlayout

scroll in DrawerLayout


My slide menu works perfect but when I want to scroll in slide menu I can't. I have enough items in list view to scroll. How to scroll in DrawerLayout? The scroll bar shows but I cant do anything. Should I add it programmatically?

<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">
    <ScrollView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">
    <!-- Framelayout to display Fragments -->
    <FrameLayout
        android:id="@+id/frame_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
    </ScrollView>
    <!-- Listview to display slider menu -->
    <ListView
        android:id="@+id/list_slidermenu"
        android:layout_width="240dp"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:choiceMode="singleChoice"
        android:divider="@color/list_divider"
        android:dividerHeight="1dp"
        android:listSelector="@drawable/list_selector"
        android:background="@color/list_background"
     />

    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">
        <Button
            android:id="@+id/btn_pick"
            android:layout_width="90dp"
            android:layout_height="55dp"
            android:layout_alignParentBottom="true"
            android:text="pick" />
        <Button
            android:id="@+id/sticker"
            android:layout_width="90dp"
            android:layout_height="55dp"
            android:text="add sticker"
            android:layout_below="@+id/paint_view"
            android:layout_alignParentRight="true"
            android:layout_alignParentEnd="true" />
        <Button
            android:id="@+id/save"
            android:layout_width="90dp"
            android:layout_height="55dp"
            android:text="save"
            android:layout_alignParentBottom="true"
            android:layout_centerHorizontal="true" />
    <in.wptrafficanalyzer.graphicspickimageviewcanvas.PaintView
        android:id="@+id/paint_view"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_above="@id/btn_pick" />
    </RelativeLayout>
</android.support.v4.widget.DrawerLayout>

Solution

  • You need to put your other widgets into the frame layout, try this,

    <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">
    
    <FrameLayout
        android:id="@+id/frame_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
    
        <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">
    
            <Button
                android:id="@+id/btn_pick"
                android:layout_width="90dp"
                android:layout_height="55dp"
                android:layout_alignParentBottom="true"
                android:text="pick" />
    
            <Button
                android:id="@+id/sticker"
                android:layout_width="90dp"
                android:layout_height="55dp"
                android:text="add sticker"
                android:layout_below="@+id/paint_view"
                android:layout_alignParentRight="true"
                android:layout_alignParentEnd="true" />
            <Button
                android:id="@+id/save"
                android:layout_width="90dp"
                android:layout_height="55dp"
                android:text="save"
                android:layout_alignParentBottom="true"
                android:layout_centerHorizontal="true" />
            <in.wptrafficanalyzer.graphicspickimageviewcanvas.PaintView
                android:id="@+id/paint_view"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_above="@id/btn_pick" />
        </RelativeLayout>
    
    </FrameLayout>
    
    <ListView
        android:id="@+id/list_slidermenu"
        android:layout_width="240dp"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:choiceMode="singleChoice"
        android:divider="@color/list_divider"
        android:dividerHeight="1dp"
        android:listSelector="@drawable/list_selector"
        android:background="@color/list_background"
     />