About
Home > Tutorials Home > Android > Sliding Drawer Example In Android

Sliding Drawer Example In Android

Published on October 17, 2019 8:24:56 PM

We are an online tutoring company that has laid its foundation in utilizing Multiple Intelligence methodology to understand specific needs and learning styles of a student.So that we patch a particular student to a tutor having a compatible teaching style. We have devised a smart online tutoring system to give you measurable results.Schools, cramped with students, fail to give your child the edge, the motivation and the right teacher guidance to help him find the true potential. We at Eonlinetutors.com make sure that your child gets the perfect learning environment to outperform.



Step 1 : Open the Eclipse and create a new Android project using Blank Activity application template. Give the application name "SlidingDrawer Example in Android".

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
    	 android:layout_width="fill_parent"
         android:layout_height="wrap_content"
         android:orientation="vertical"
         android:gravity="center_vertical|center_horizontal">

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal">

            <TextView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="Registration Form!!!"
                android:textSize="20dp"
                android:gravity="center_horizontal"/>
        </LinearLayout>
      
        <LinearLayout
               android:layout_width="fill_parent"
               android:layout_height="wrap_content"
               android:orientation="horizontal">
             <TextView
                    android:text="UserName"
                    android:layout_width="100dp"
                    android:layout_height="wrap_content"/>
             <EditText
                    android:id="@+id/uname"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:inputType="text"/>
		</LinearLayout>

     	<LinearLayout
               android:layout_width="fill_parent"
               android:layout_height="wrap_content"
               android:orientation="horizontal">
               <TextView
                    android:text="Password"
                   android:layout_width="100dp"
                    android:layout_height="wrap_content"/>
               <EditText
                    android:id="@+id/password"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:inputType="text"/>
		</LinearLayout>

     	<LinearLayout
               android:layout_width="fill_parent"
               android:layout_height="wrap_content"
               android:orientation="horizontal">
			   
               <TextView
                    android:text="First Name"
                    android:layout_width="100dp"
                    android:layout_height="wrap_content"/>
					
               <EditText
                    android:id="@+id/fname"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:inputType="text"/>
					
        </LinearLayout>

     	<LinearLayout
               android:layout_width="fill_parent"
               android:layout_height="wrap_content"
               android:orientation="horizontal">
			   
               <TextView
                    android:text="Mobile No."
                    android:layout_width="100dp"
                    android:layout_height="wrap_content"/>
					
               <EditText
                    android:id="@+id/mno"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:inputType="number"/>
					
        </LinearLayout>

     	<LinearLayout
               android:layout_width="fill_parent"
               android:layout_height="wrap_content"
               android:orientation="horizontal"
               android:gravity="center_vertical|center_horizontal">
               <Button
                    android:text="Registration"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"/>
					
        </LinearLayout>     	

	</LinearLayout>
	
    <SlidingDrawer
        android:id="@+id/slider"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="15dp"
        android:content="@+id/content"
        android:handle="@+id/handle" >

        <Button
            android:id="@+id/handle"
            android:layout_width="150dp"
            android:layout_height="40dp"
            android:text="Login!!"
            android:textSize="15dp"
            android:textColor="#ffffff"
            android:background="#000000"/>

        <LinearLayout
            android:id="@+id/content"
            android:layout_width="match_parent"
            android:layout_height="fill_parent"
            android:orientation="horizontal"
            android:background="#000000">

            <LinearLayout
                  android:layout_width="wrap_content"
                  android:layout_height="fill_parent"
                  android:orientation="vertical"
                  android:padding="10dp"
                  android:background="#E6E6FA"
                  android:gravity="center_horizontal|center_vertical">               

              <LinearLayout
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:orientation="horizontal" >
                  <TextView
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:text="Login Form!!"
                      android:textSize="20dp"/>
              </LinearLayout>
			                 	 
              <LinearLayout
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:orientation="horizontal">
                  <TextView
                      android:layout_width="100dp"
                      android:layout_height="wrap_content"
                      android:text="User Name"
                      android:textSize="15dp"/>
                  <EditText
                      android:layout_width="200dp"
                      android:layout_height="wrap_content"/>
              </LinearLayout>               	  

              <LinearLayout
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:orientation="horizontal">
                  <TextView
                      android:layout_width="100dp"
                      android:layout_height="wrap_content"
                      android:text="Password"
                      android:textSize="15dp"/>
                  <EditText
                      android:layout_width="200dp"
                      android:layout_height="wrap_content"/>
              </LinearLayout>
               
              <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal"
                    android:gravity="center_vertical|center_horizontal">
                  
                    <Button
                        android:layout_width="150dp"
                        android:layout_height="wrap_content"
                        android:text="Login" />                  

              </LinearLayout>
			</LinearLayout>
		</LinearLayout>       
    </SlidingDrawer>
</RelativeLayout>
ALL COMMENTS (2)
Abhishek Bedre 2017-03-28 17:25:15
I have implemented my own "jarvis"....thanks to this example.        
2019-01-03 13:22:19
It is working fine in desktop but not working in android mobile