Search code examples
androidandroid-actionbarslidingdrawer

Scrolling handle of sliding drawer under actionbar


I have a Sliding Drawer in an activity. I have programmed that when the drawer is open, change the menu title and options and I make the handle of the drawer gone and I do the opposite when the drawer is closed. What I want to do now is to make the handle scrolls under the actionbar because it does not look nice to disappear a view suddenly. I have seen an app which does this but I have no idea how. Any ideas?


Solution

  • No one answered me. I found out the answer myself. I know SlidingDrawer is not a popular widget but anyway here is the simplest way to achieve that. Hope to be helpful for some one who need it.

    <SlidingDrawer
        android:id="@+id/slidingDrawer"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:content="@+id/content"
        android:handle="@+id/handle"
        android:bottomOffset="4.0dip" 
        android:topOffset="-50.0dip">
    

    You can simply set bottomOffset and topOffset to achieve that.