Reputation: 2409
My application contains a screen which contains a horizental SlidingDrawer. When user perss on the drawer handle, the drawer should "cover" the whole screen. when it closed, the "original" screen should reveal. I have located the drawer in a FrameLayout but the handle disappeared.
How it can resolved?
Thanks, Eyal
Upvotes: 0
Views: 1389
Reputation: 55555
Funny, I just solved this problem not to long ago. It took me a little while but after some Googling and testing I came up with this:
Basically I put my entire layout into a "Relative Layout" and then created a "Linear Layout" inside of that for the main stuff. Inside the "Relative Layout" but outside of the "Linear Layout" I put my "SlidingDrawer". I am showing the buttons and handle in the xml below. Also, I created a "Linear Layout" in my "SlidingDrawer" for content.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
..stuff for the main screen
</LinearLayout>
<SlidingDrawer
android:id="@+id/SlidingDrawer"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:content="@+id/contentLayout"
android:handle="@+id/slideHandleButton" >
<Button
android:id="@+id/slideHandleButton"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/list_background"
android:padding="8dp"
android:text="My App"
android:textSize="7pt" >
</Button>
<LinearLayout>
...sliding drawing is at the bottom
...stuff in here will be in the sliding drawer
</LinearLayout>
</SlidingDrawer>
</RelativeLayout>
Before posting this, I just ran my test application with this code and it works. If you have any questions, please ask and I hope this helps.
Upvotes: 3