Create smooth sliding menu using sliding drawer on action title bar.
Sliding menus is similar to web applications sliding widgets mostly sees on websites at left or right side containing Facebook page like box, Google plus like box, share page widgets. But my in this tutorial i am creating sliding menus simple with smooth slide effect to show android applications most used menus on slide in slide out function. So here is the complete step by step tutorial for Android sliding horizontal menu using drawer tutorial example.
Android sliding horizontal menu using drawer tutorial example.
Note: Download and put round arrow icon image into res->drawable-hdpi folder.
Image icon :
Code for MainActivity.java file.
package com.slidingtabmenu; import android.app.Activity; import android.os.Bundle; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } }
Code for activity_main.xml layout file.
<LinearLayout 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" tools:context="com.slidingdraweropenclose_android_examples.com.MainActivity" android:orientation="vertical" > <SlidingDrawer android:id="@+id/drawer" android:layout_width="fill_parent" android:orientation="horizontal" android:handle="@+id/handle" android:rotation="180" android:content="@+id/content" android:layout_height="60dp" android:background="#016b5f" > <ImageView android:id="@id/handle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/round_icon" android:rotation="180" /> <LinearLayout android:id="@id/content" android:layout_width="fill_parent" android:layout_height="fill_parent" android:rotation="180" android:orientation="horizontal" android:background="#016b5f"> <Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="ONE" android:textColor="#feffff"/> <Button android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="TWO" android:textColor="#feffff"/> <Button android:id="@+id/button3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="THREE" android:textColor="#feffff"/> </LinearLayout> </SlidingDrawer> </LinearLayout>
Screenshots: