- The SlidingDrawer configuration expand horizontally or vertically ,expand the two (the android: orientation) mode
must be specified in XML, use the "android: handle" with the "android: content".
these two events has been closed, set the Listener for SlidingDrawer.setOnDrawerOpenListener ()
SlidingDrawer.setOnDrawerCloseListener ().
SlidingDrawer.setOnDrawerCloseListener
-Established in the main program SlidingDrawer object, in order to capture the Open finished with
1.Main XML Layout :
<?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" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
android:textSize="16sp" />
<SlidingDrawer
android:id="@+id/drawer1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:content="@+id/myContent1"
android:handle="@+id/layout1"
android:orientation="horizontal" >
<LinearLayout
android:id="@id/layout1"
android:layout_width="35px"
android:layout_height="fill_parent"
android:background="@drawable/black"
android:gravity="center" >
<ImageView
android:id="@+id/myImage1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/open" />
</LinearLayout>
<GridView
android:id="@id/myContent1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/black"
android:gravity="center"
android:numColumns="2" />
</SlidingDrawer>
</RelativeLayout>
2.Main Activity :
package slm.abdennour.coach; |
3.grid.xml Layout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dip" />
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dip" />
</LinearLayout>
4-Adapter Activity :
|
5-Demo Video :
السلام عليكم
ReplyDeleteبارك الله فيك أخي
أصبحنا نتعلم منك
أحمد
This comment has been removed by the author.
ReplyDeleteو عليكم السلام و رحمة الله و بركاته
ReplyDeleteو فيك بارك الله
حللتم , أهلا و سهلا