Do you know how to achieve the same effect as winamp for android ? I want to do the similar thing. That is when I click on listview, sliding drawer popup. But so far I only can show the sliding drawer in new activity not in the same.
How can I achieve in overlap view. That is when I close the drawer, the layout is show at the front, and the sliding handle is on the layout, when I open the drawer, it covers the main layout.
Any ideas about that ?
Thanks !!
Step #1: Create a RelativeLayout
Step #2: Put the rest of your UI in the RelativeLayout
Step #3: Put the SlidingDrawer
in the RelativeLayout
as a later child then the rest of the UI (e.g., in layout XML, have it as the last child element of the RelativeLayout
)
Children of RelativeLayout
(and FrameLayout
) stack on top of one another on the Z-axis (i.e., out the face of the screen). Hence, later children will overlap earlier ones. By putting your SlidingDrawer
last, it will overlap everything else when opened.
Thank you CommonsWare you helped me,I do not have much reputation to vote up. Here is my sample layout...
I used it.sephiroth.slider.widget.MultiDirectionSlidingDrawer
as the SlidingDrawer
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_alignParentLeft="true" android:layout_marginLeft="82dp"
android:layout_alignTop="@+id/button_open">
<Button
android:id="@+id/button_open"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="@string/open"
android:visibility="visible" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New EditText"
android:id="@+id/editText" android:layout_alignParentLeft="true" android:layout_marginLeft="114dp"
android:layout_alignParentTop="true" android:layout_marginTop="6dp"/>
</RelativeLayout>
<it.sephiroth.demo.slider.widget.MultiDirectionSlidingDrawer
xmlns:panel="http://schemas.android.com/apk/res/it.sephiroth.demo.slider"
android:id="@+id/drawer"
panel:direction="topToBottom"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
panel:handle="@+id/handle"
panel:content="@+id/content">
<include
android:id="@id/content"
layout="@layout/pen_content" />
<ImageView
android:id="@id/handle"
android:layout_width="wrap_content"
android:layout_height="40px"
android:src="@drawable/sliding_drawer_handle_bottom" />
</it.sephiroth.demo.slider.widget.MultiDirectionSlidingDrawer>
</RelativeLayout>