Apr 14, 2011

Example to implement SlidingDrawer in XML

SlidingDrawer hides content out of the screen and allows the user to drag a handle to bring the content on screen.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
<SlidingDrawer
android:id="@+id/drawer"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:handle="@+id/handle"
android:content="@+id/content">
<ImageView
android:id="@id/handle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/icon"/>
<LinearLayout
android:id="@id/content"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<Button
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="Big Big Button"/>
</LinearLayout>

</SlidingDrawer>
</LinearLayout>


Example of SlidingDrawer
Example of SlidingDrawer

2 comments:

  1. but how to implement the same from top to bottom.Can u plz instruct us ..

    ReplyDelete
  2. Here's some useful links for doing it top to bottom:
    http://stackoverflow.com/questions/11863343/making-a-slidable-view-from-top-to-down-similar-to-the-one-in-android
    http://stackoverflow.com/questions/1137350/how-to-make-an-android-slidingdrawer-slide-out-from-the-left
    http://blog.sephiroth.it/2011/03/29/widget-slidingdrawer-top-to-bottom

    ReplyDelete

Infolinks In Text Ads