4

Is there a way on how I could hide the handle of a sliding drawer upon opening the sliding drawer? I've tried using the setVisibility(View.GONE) method when the OnDrawerOpenListener was triggered, but the handle is still visible. Is it possible to hide the handle of the drawer or it would always be visible? Here's a snippet of the xml of my sliding drawer:

        <SlidingDrawer android:layout_width="wrap_content"
        android:id="@+id/notifDrawer" android:handle="@+id/notifHandle"
        android:content="@+id/notifContent" android:layout_height="fill_parent"
        android:orientation="horizontal">
        <LinearLayout android:id="@+id/notifHandle"
            android:layout_width="wrap_content" android:layout_height="fill_parent"
            android:background="@drawable/button_selected" android:orientation="vertical"
            android:padding="0dip" android:gravity="center">
            <TextView android:id="@+id/notification_count"
                android:visibility="gone" android:layout_width="wrap_content"
                android:layout_height="wrap_content" android:textSize="10sp"
                android:textStyle="bold" android:textColor="#FFFFFF"
                android:gravity="center" android:background="@drawable/badge">
            </TextView>
        </LinearLayout>
        <ListView android:id="@+id/notifContent"
            android:layout_width="fill_parent" android:layout_height="fill_parent"
            android:background="#C0C0C0" android:divider="@drawable/divider"
            android:fadingEdge="none">
        </ListView>
    </SlidingDrawer>
Ivan
  • 41
  • 1
  • 3

4 Answers4

3

Following trick worked for me

    <Button
      android:id="@+id/handle"
      android:layout_width="0dp"
      android:layout_height="0dp"
      android:background="#00000000" />
Samrakchan
  • 342
  • 3
  • 15
  • if we do that handle will be invisible because of width and height. so how are you able to handle the touch(or sliding) events of the SlidingDrawer. please let me know if you have some solution. – Raj Jul 28 '12 at 09:55
  • I created a button for handeling touch event. – Samrakchan Sep 03 '12 at 18:23
2

What I did is below to be able to hide the handle:

<LinearLayout android:layout_width="fill_parent"
        android:layout_height="fill_parent" android:gravity="bottom"
        android:orientation="vertical">
        <SlidingDrawer android:layout_width="fill_parent"
            android:id="@+id/drawerShare" android:handle="@+id/slideHandleButton2"
            android:content="@+id/contentLayout" android:layout_height="fill_paren`enter code here`t"
            android:orientation="horizontal">

            <Button android:layout_width="0px" android:layout_height="0px"
                android:id="@+id/slideHandleButton2">
            </Button>
....

I set the layout_width and layout_height of the button that is defined as my handle to 0px. Hope this helps.

a paid nerd
  • 30,702
  • 30
  • 134
  • 179
0

What I did is to set the image of the handle ImageButton to the first 300x1 or so pixels of the background, so that it adds an additional line at the bottom that isn't noticeable.

Velizar Hristov
  • 662
  • 2
  • 10
  • 23
0

I created a complete replacement for Google's SlidingDrawer widget. http://www.github.com/kedzie/DraggableDrawers It allows drawers without handles (which are opened programmatically) or simple calling drawer.getHandle().setVisibility(GONE);

mark.kedzierski
  • 663
  • 4
  • 10