SlidingDrawer :
-hides content out of the screen(cache le contenu hors de l'écran.)
-allows user to drag a handle to bring the content on screen.
==> SlidingDrawer= define the id of the handle + the content:
That Meaning :When I click On "The "Handle" ,"the Content" will appear
handle | small graphic ==> indicate opening/closing ctrl |
content | type of container holding(as GridView) |
=>SlidingDraw.animateClose(); //hide(cacher) le slidingDraw
Notes :
1)SlidingDrawer can be used vertically or horizontally.
2)SlidingDrawer should be used as an overlay(superposition de layout) inside layouts.
2)SlidingDrawer should be used as an overlay(superposition de layout) inside layouts.
=>This means SlidingDrawer should only be used inside of a
FrameLayout or a RelativeLayout for instance.
3) The size of the SlidingDrawer defines how much space the content will occupy once slid out .
=>SlidingDrawer should usually use fill_parent for both its dimensions.
Example1 :
<SlidingDrawer
android:id="@+id/drawer"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:handle="@+id/handle"
android:content="@+id/content">
<ImageView
android:id="@id/handle"
android:layout_width="88dip"
android:layout_height="44dip" />
<GridView
android:id="@id/content"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</SlidingDrawer>
Example2 : Full Example :
1)In main.Xml :
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FF4444CC" >
<SlidingDrawer
android:id="@+id/drawer"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentBottom="true"
android:content="@+id/content"
android:handle="@+id/handle" >
<ImageView
android:id="@id/handle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher" />
<LinearLayout
android:id="@id/content"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ff006666"
android:orientation="vertical" >
<TextView
android:id="@+id/label1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#ff006666"
android:text="Line 1"
android:textSize="22sp" />
<TextView
android:id="@+id/label2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#ff669900"
android:text="Line 2"
android:textSize="22sp" />
<TextView
android:id="@+id/label3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#ff0000cc"
android:text="Line 3"
android:textSize="22sp" />
<TextView
android:id="@+id/filler1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="6sp" />
<Button
android:id="@+id/btn1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="4px"
android:text=" btn1 - time? " />
<Button
android:id="@+id/btn2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="4px"
android:text=" btn2 - close " />
</LinearLayout>
</SlidingDrawer>
</RelativeLayout>
2)Activity Code :
3)Result : References : -->Victor Matoas's Android Tuto |
No comments:
Post a Comment