Left & Right SlideMenu

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.

1. MainActivity.java

package com.tutorialsee.leftorrightside.slidemenu;

import android.app.Activity;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.animation.Animation;
import android.view.animation.TranslateAnimation;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;

public class MainActivity extends Activity {

// Declare
private LinearLayout slidingPanel;
private boolean isExpanded;
private DisplayMetrics metrics;
private RelativeLayout headerPanel;
private int panelWidth;
private int panelWidth1;

private ImageView menuViewButton,menuRightButton;

FrameLayout.LayoutParams menuPanelParameters;
FrameLayout.LayoutParams slidingPanelParameters;
LinearLayout.LayoutParams headerPanelParameters;
LinearLayout.LayoutParams listViewParameters;

@Override
protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);
setContentView(R.layout.activity_layer_stack);

// Initialize
metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
panelWidth = (int) ((metrics.widthPixels) * -0.75);
panelWidth1 = (int) ((metrics.widthPixels) * 0.75);

headerPanel = (RelativeLayout) findViewById(R.id.header);
headerPanelParameters = (LinearLayout.LayoutParams) headerPanel.getLayoutParams();
headerPanelParameters.width = metrics.widthPixels;
headerPanel.setLayoutParams(headerPanelParameters);

slidingPanel = (LinearLayout) findViewById(R.id.slidingPanel);
slidingPanelParameters = (FrameLayout.LayoutParams) slidingPanel .getLayoutParams();
slidingPanelParameters.width = metrics.widthPixels;
slidingPanel.setLayoutParams(slidingPanelParameters);

// Slide the Panel
menuRightButton = (ImageView) findViewById(R.id.menuViewButton);
menuRightButton.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View v) {
if (!isExpanded) {
isExpanded = true;
// Expand

FragmentManager fragmentManager = getFragmentManager();

FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.menuPanel, new LeftMenuFragment());
fragmentTransaction.commit();
new ExpandAnimation(slidingPanel, panelWidth1,Animation.RELATIVE_TO_SELF, 0.0f,
Animation.RELATIVE_TO_SELF, 0.75f, 0, 0.0f, 0, 0.0f);

} else {
isExpanded = false;
// Collapse

new CollapseAnimation(slidingPanel, panelWidth1,
TranslateAnimation.RELATIVE_TO_SELF, 0.75f,
TranslateAnimation.RELATIVE_TO_SELF, 0.0f, 0, 0.0f,
0, 0.0f);

}
}
});

menuViewButton = (ImageView) findViewById(R.id.menuRightButton);
menuViewButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
if (!isExpanded) {
isExpanded = true;

// Expand

FragmentManager fragmentManager = getFragmentManager();

FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.menuPanel, new RightMenuFragment());
fragmentTransaction.commit();
new ExpandAnimation(slidingPanel, panelWidth,
Animation.RELATIVE_TO_SELF, 0.0f,
Animation.RELATIVE_TO_SELF, -0.75f, 0, 0.0f, 0,
0.0f);

} else {
isExpanded = false;

// Collapse
new CollapseAnimation(slidingPanel, panelWidth,
TranslateAnimation.RELATIVE_TO_SELF, -0.75f,
TranslateAnimation.RELATIVE_TO_SELF, 0.0f, 0, 0.0f,
0, 0.0f);

}
}
});

}
}

2. CollapseAnimation.java

package com.tutorialsee.leftorrightside.slidemenu;

import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.Animation;
import android.view.animation.TranslateAnimation;
import android.widget.FrameLayout.LayoutParams;
import android.widget.LinearLayout;

public class CollapseAnimation extends TranslateAnimation implements
TranslateAnimation.AnimationListener {

private LinearLayout mainLayout;
int panelWidth;

public CollapseAnimation(LinearLayout layout, int width, int fromXType,
float fromXValue, int toXType, float toXValue, int fromYType,
float fromYValue, int toYType, float toYValue) {

super(fromXType, fromXValue, toXType, toXValue, fromYType, fromYValue,
toYType, toYValue);

// Initialize
mainLayout = layout;
panelWidth = width;
setDuration(400);
setFillAfter(false);
setInterpolator(new AccelerateDecelerateInterpolator());
setAnimationListener(this);

// Clear left and right margins
LayoutParams params = (LayoutParams) mainLayout.getLayoutParams();
params.rightMargin = 0;
params.leftMargin = 0;
mainLayout.setLayoutParams(params);
mainLayout.requestLayout();
mainLayout.startAnimation(this);

}
public void onAnimationEnd(Animation animation) {
// not implemented
}
public void onAnimationRepeat(Animation animation) {
// not implemented
}
public void onAnimationStart(Animation animation) {
// not implemented
}
}

3. ExpandAnimation.java

package com.tutorialsee.leftorrightside.slidemenu;

import android.view.Gravity;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.Animation;
import android.view.animation.TranslateAnimation;
import android.widget.FrameLayout.LayoutParams;
import android.widget.LinearLayout;

public class ExpandAnimation extends TranslateAnimation implements Animation.AnimationListener {

private LinearLayout mainLayout;
int panelWidth;

public ExpandAnimation(LinearLayout layout, int width, int fromXType,
float fromXValue, int toXType, float toXValue, int fromYType,
float fromYValue, int toYType, float toYValue) {

super(fromXType, fromXValue, toXType, toXValue, fromYType, fromYValue,toYType, toYValue);

// Initialize
mainLayout = layout;
panelWidth = width;
setDuration(400);
setFillAfter(false);
setInterpolator(new AccelerateDecelerateInterpolator());
setAnimationListener(this);
mainLayout.startAnimation(this);
}

public void onAnimationEnd(Animation arg0) {

// Create margin and align left
LayoutParams params = (LayoutParams) mainLayout.getLayoutParams();
params.leftMargin = panelWidth;
params.gravity = Gravity.LEFT;
mainLayout.clearAnimation();
mainLayout.setLayoutParams(params);
mainLayout.requestLayout();

}

public void onAnimationRepeat(Animation arg0) {

}

public void onAnimationStart(Animation arg0) {

}
}

4. LeftMenuFragment.java

package com.tutorialsee.leftorrightside.slidemenu;

import com.tutorialsee.leftorrightside.slidemenu.R;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

public class LeftMenuFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.leftmenu, container, false);
}
}

5. RightMenuFragment.java

package com.tutorialsee.leftorrightside.slidemenu;

import com.tutorialsee.leftorrightside.slidemenu.R;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

public class RightMenuFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.rightmenu, container, false);
}

}

6. activity_layer_stack.xml

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <!-- Right or left Menu Panel -->
    <FrameLayout
        android:id="@+id/menuPanel"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
         >
      
    </FrameLayout>
   
    <!-- Main Panel -->
    <!-- start -->
<LinearLayout
        android:id="@+id/slidingPanel"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="@android:color/white"
        android:gravity="left"
        android:orientation="vertical" >

        <RelativeLayout
            android:id="@+id/header"
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:background="@drawable/blue_bg" >

            <View
                android:id="@+id/header_vertical_divider_1"
                android:layout_width="2dp"
                android:layout_height="fill_parent"
                android:layout_alignParentTop="true"
                android:layout_marginLeft="15dp"
                android:layout_toRightOf="@+id/menuViewButton"
                android:background="@drawable/engraved_bg" />

            <ImageView
                android:id="@+id/menuViewButton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_centerVertical="true"
                android:layout_marginLeft="15dp"
                android:clickable="true"
                android:contentDescription="@string/description"
                android:src="@drawable/icon_menu"
                android:visibility="visible" />

            <View
                android:id="@+id/header_vertical_divider_2"
                android:layout_width="2dp"
                android:layout_height="fill_parent"
                android:layout_alignParentTop="true"
                android:layout_marginLeft="15dp"
                android:layout_toLeftOf="@+id/menuRightButton"
                android:background="@drawable/engraved_bg" />

            <ImageView
                android:id="@+id/menuRightButton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:layout_centerVertical="true"
                android:layout_marginLeft="15dp"
                android:clickable="true"
                android:contentDescription="@string/description"
                android:src="@drawable/icon_menu"
                android:visibility="visible" />
        </RelativeLayout>

        <View
            android:id="@+id/dividerHeaderBottom"
            android:layout_width="fill_parent"
            android:layout_height="1dp"
            android:background="#414141" />

        <TextView
            android:id="@+id/list"
            android:layout_width="match_parent"
            android:layout_height="fill_parent"
            android:background="#FAFAFA"
            android:gravity="center"
            android:textSize="15sp"
            android:textColor="@android:color/black"
            android:text="Left Or Right Sliding menu"
            android:dividerHeight="0.5dp" />
       
    </LinearLayout> 
      <!-- End -->
</FrameLayout>

7. leftmenu.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/left_drawer"
    android:layout_width="240dp"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:background="@color/sliding_menu_bg" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_above="@+id/footer"
        android:fillViewport="true" >

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@color/slider1"
            android:orientation="vertical" >

            <LinearLayout
                android:id="@+id/lin134"
                android:layout_width="match_parent"
                android:layout_height="10dp"
                android:background="@color/slider2"
                android:orientation="horizontal"
                android:padding="3dp" >
            </LinearLayout>

            <LinearLayout
                android:id="@+id/lin1"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@color/slider2"
                android:padding="3dp" >

                <TextView
                    android:id="@+id/name"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="10dp"
                    android:text="Welcome "
                    android:textColor="@color/slider3"
                    android:textSize="15sp" />

                <TextView
                    android:id="@+id/username"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="5dp"
                    android:text="guest"
                    android:textAllCaps="true"
                    android:textColor="@color/slider3"
                    android:textSize="15sp"
                    android:textStyle="bold" />

                <TextView
                    android:id="@+id/ussddsername"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="1dp"
                    android:text=" !"
                    android:textColor="@color/slider3"
                    android:textSize="15sp"
                    android:textStyle="bold" />
            </LinearLayout>

            <LinearLayout
                android:id="@+id/l"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@color/slider1"
                android:orientation="horizontal" >

                <LinearLayout
                    android:id="@+id/le"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="0.1dp"
                    android:layout_marginTop="0.1dp"
                    android:background="@color/slider1"
                    android:baselineAligned="false"
                    android:orientation="horizontal" >

                    <RelativeLayout
                        android:id="@+id/lin2"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:background="@color/slider2"
                        android:orientation="horizontal"
                        android:padding="8dp" >

                        <ImageView
                            android:id="@+id/btn_home"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginLeft="7dp"
                            android:background="@null"
                            android:contentDescription="@drawable/home"
                            android:src="@drawable/home" />

                        <TextView
                            android:id="@+id/_ord"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center"
                            android:layout_marginLeft="40dp"
                            android:layout_marginTop="2dp"
                            android:text="Home"
                            android:textColor="@color/slider3"
                            android:textSize="15sp" />
                    </RelativeLayout>

                    <RelativeLayout
                        android:id="@+id/lin9"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:layout_marginLeft="0.1dp"
                        android:layout_weight="1"
                        android:background="@color/slider2"
                        android:orientation="horizontal"
                        android:padding="8dp"
                        android:visibility="visible" >

                        <TextView
                            android:id="@+id/_ordd"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:gravity="center"
                            android:text="Login"
                            android:textColor="@color/slider3"
                            android:textSize="15sp" />
                    </RelativeLayout>
                </LinearLayout>
            </LinearLayout>
<ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/slider1"
        android:fillViewport="true"
        android:scrollbars="none"
        android:fadingEdge="none" >
               
       <LinearLayout
                android:id="@+id/ldssd"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@color/slider1"
                android:orientation="vertical"
                android:fadingEdge="none" >
    
            <RelativeLayout
                android:id="@+id/lin11"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="0.1dp"
                android:background="@color/slider2"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/_orddd"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginTop="2dp"
                    android:padding="12dp"
                    android:text="Layout1"
                    android:textColor="@color/slider3"
                    android:textSize="15sp" />
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/lin12"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="0.1dp"
                android:background="@color/slider2"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/_orddddddd"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginTop="2dp"
                    android:padding="12dp"
                    android:text="Layout2"
                    android:textColor="@color/slider3"
                    android:textSize="15sp" />
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/lin13"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="0.1dp"
                android:background="@color/slider2"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/_ordddd"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginTop="2dp"
                    android:padding="12dp"
                    android:text="Layout3"
                    android:textColor="@color/slider3"
                    android:textSize="15sp" />
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/lin14"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="0.1dp"
                android:background="@color/slider2"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/_ordddg"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginTop="2dp"
                    android:padding="12dp"
                    android:text="Layout4"
                    android:textColor="@color/slider3"
                    android:textSize="15sp" />
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/lin15"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="0.1dp"
                android:background="@color/slider2"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/Layout5"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginTop="2dp"
                    android:padding="12dp"
                    android:text="Layout5"
                    android:textColor="@color/slider3"
                    android:textSize="15sp" />
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/lin16"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="0.1dp"
                android:background="@color/slider2"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/Layout6"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginTop="2dp"
                    android:padding="12dp"
                    android:text="Layout6"
                    android:textColor="@color/slider3"
                    android:textSize="15sp" />
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/lin17"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="0.1dp"
                android:background="@color/slider2"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/Layout7"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginTop="2dp"
                    android:padding="12dp"
                    android:text="Layout7"
                    android:textColor="@color/slider3"
                    android:textSize="15sp" />
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/lin18"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="0.1dp"
                android:background="@color/slider2"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/Layout8"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginTop="2dp"
                    android:padding="12dp"
                    android:text="Layout8"
                    android:textColor="@color/slider3"
                    android:textSize="15sp" />
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/lin19"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="0.1dp"
                android:background="@color/slider2"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/Layout9"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginTop="2dp"
                    android:padding="12dp"
                    android:text="Layout9"
                    android:textColor="@color/slider3"
                    android:textSize="15sp" />
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/lin20"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="0.1dp"
                android:background="@color/slider2"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/_ocvcrddd"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginTop="2dp"
                    android:padding="12dp"
                    android:text="Layout10"
                    android:textColor="@color/slider3"
                    android:textSize="15sp" />
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/lin21"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="0.1dp"
                android:background="@color/slider2"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/_ordddngfgfddddd"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginTop="2dp"
                    android:padding="12dp"
                    android:text="Layout11"
                    android:textColor="@color/slider3"
                    android:textSize="15sp" />
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/lin22"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="0.1dp"
                android:background="@color/slider2"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/_orfhgdddd"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginTop="2dp"
                    android:padding="12dp"
                    android:text="Layout12"
                    android:textColor="@color/slider3"
                    android:textSize="15sp" />
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/lin23"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="0.1dp"
                android:background="@color/slider2"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/_orfghfgdddg"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginTop="2dp"
                    android:padding="12dp"
                    android:text="Layout13"
                    android:textColor="@color/slider3"
                    android:textSize="15sp" />
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/lin24"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="0.1dp"
                android:background="@color/slider2"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/Layoufgft5"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginTop="2dp"
                    android:padding="12dp"
                    android:text="Layout14"
                    android:textColor="@color/slider3"
                    android:textSize="15sp" />
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/lin25"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="0.1dp"
                android:background="@color/slider2"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/Layouhfht6"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginTop="2dp"
                    android:padding="12dp"
                    android:text="Layout15"
                    android:textColor="@color/slider3"
                    android:textSize="15sp" />
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/lin26"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="0.1dp"
                android:background="@color/slider2"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/Layoughgft7"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginTop="2dp"
                    android:padding="12dp"
                    android:text="Layout16"
                    android:textColor="@color/slider3"
                    android:textSize="15sp" />
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/lin27"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="0.1dp"
                android:background="@color/slider2"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/Layoutgfh8"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginTop="2dp"
                    android:padding="12dp"
                    android:text="Layout17"
                    android:textColor="@color/slider3"
                    android:textSize="15sp" />
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/lin28"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="0.1dp"
                android:background="@color/slider2"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/Lafgfyout9"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginTop="2dp"
                    android:padding="12dp"
                    android:text="Layout18"
                    android:textColor="@color/slider3"
                    android:textSize="15sp" />
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/lin29"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="0.1dp"
                android:background="@color/slider2"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/Lafgfyoghut9"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginTop="2dp"
                    android:padding="12dp"
                    android:text="Layout19"
                    android:textColor="@color/slider3"
                    android:textSize="15sp" />
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/lin30"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="0.1dp"
                android:background="@color/slider2"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/Ladfgfgfyout9"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginTop="2dp"
                    android:padding="12dp"
                    android:text="Layout20"
                    android:textColor="@color/slider3"
                    android:textSize="15sp" />
            </RelativeLayout>
            </LinearLayout>
            </ScrollView>
        </LinearLayout>
    </LinearLayout>
</RelativeLayout>

8. rightmenu.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/left_drawer"
    android:layout_width="240dp"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:layout_marginLeft="80dp"
    android:background="@color/sliding_menu_bg" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_above="@+id/footer"
        android:fillViewport="true" >

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@color/slider1"
            android:orientation="vertical" >

            <LinearLayout
                android:id="@+id/lin134"
                android:layout_width="match_parent"
                android:layout_height="10dp"
                android:background="@color/slider2"
                android:orientation="horizontal"
                android:padding="3dp" >
            </LinearLayout>

            <LinearLayout
                android:id="@+id/lin1"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@color/slider2"
                android:padding="3dp" >

                <TextView
                    android:id="@+id/name"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="10dp"
                    android:text="Welcome "
                    android:textColor="@color/slider3"
                    android:textSize="15sp" />

                <TextView
                    android:id="@+id/username"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="5dp"
                    android:text="guest"
                    android:textAllCaps="true"
                    android:textColor="@color/slider3"
                    android:textSize="15sp"
                    android:textStyle="bold" />

                <TextView
                    android:id="@+id/ussddsername"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="1dp"
                    android:text=" !"
                    android:textColor="@color/slider3"
                    android:textSize="15sp"
                    android:textStyle="bold" />
            </LinearLayout>

            <LinearLayout
                android:id="@+id/l"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@color/slider1"
                android:orientation="horizontal" >

                <LinearLayout
                    android:id="@+id/le"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="0.1dp"
                    android:layout_marginTop="0.1dp"
                    android:background="@color/slider1"
                    android:baselineAligned="false"
                    android:orientation="horizontal" >

                    <RelativeLayout
                        android:id="@+id/lin2"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:background="@color/slider2"
                        android:orientation="horizontal"
                        android:padding="8dp" >

                        <ImageView
                            android:id="@+id/btn_home"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginLeft="7dp"
                            android:background="@null"
                              android:contentDescription="@drawable/home"
                            android:src="@drawable/home" />

                        <TextView
                            android:id="@+id/_ord"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center"
                            android:layout_marginLeft="40dp"
                            android:layout_marginTop="2dp"
                            android:text="Home"
                            android:textColor="@color/slider3"
                            android:textSize="15sp" />
                    </RelativeLayout>

                   
                   
                    <RelativeLayout
                        android:id="@+id/lin9"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:layout_marginLeft="0.1dp"
                        android:layout_weight="1"
                        android:background="@color/slider2"
                        android:orientation="horizontal"
                        android:padding="8dp"
                        android:visibility="visible" >

                        <TextView
                            android:id="@+id/_ordd"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:gravity="center"
                            android:text="Login"
                            android:textColor="@color/slider3"
                            android:textSize="15sp" />
                    </RelativeLayout>
                </LinearLayout>
            </LinearLayout>
<ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/slider1"
        android:fillViewport="true"
        android:scrollbars="none"
        android:fadingEdge="none" >
               
       <LinearLayout
                android:id="@+id/ldssd"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@color/slider1"
                android:orientation="vertical"
                android:fadingEdge="none" >
    
            <RelativeLayout
                android:id="@+id/lin11"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="0.1dp"
                android:background="@color/slider2"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/_orddd"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginTop="2dp"
                    android:padding="12dp"
                    android:text="Layout1"
                    android:textColor="@color/slider3"
                    android:textSize="15sp" />
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/lin12"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="0.1dp"
                android:background="@color/slider2"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/_orddddddd"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginTop="2dp"
                    android:padding="12dp"
                    android:text="Layout2"
                    android:textColor="@color/slider3"
                    android:textSize="15sp" />
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/lin13"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="0.1dp"
                android:background="@color/slider2"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/_ordddd"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginTop="2dp"
                    android:padding="12dp"
                    android:text="Layout3"
                    android:textColor="@color/slider3"
                    android:textSize="15sp" />
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/lin14"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="0.1dp"
                android:background="@color/slider2"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/_ordddg"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginTop="2dp"
                    android:padding="12dp"
                    android:text="Layout4"
                    android:textColor="@color/slider3"
                    android:textSize="15sp" />
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/lin15"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="0.1dp"
                android:background="@color/slider2"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/Layout5"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginTop="2dp"
                    android:padding="12dp"
                    android:text="Layout5"
                    android:textColor="@color/slider3"
                    android:textSize="15sp" />
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/lin16"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="0.1dp"
                android:background="@color/slider2"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/Layout6"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginTop="2dp"
                    android:padding="12dp"
                    android:text="Layout6"
                    android:textColor="@color/slider3"
                    android:textSize="15sp" />
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/lin17"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="0.1dp"
                android:background="@color/slider2"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/Layout7"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginTop="2dp"
                    android:padding="12dp"
                    android:text="Layout7"
                    android:textColor="@color/slider3"
                    android:textSize="15sp" />
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/lin18"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="0.1dp"
                android:background="@color/slider2"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/Layout8"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginTop="2dp"
                    android:padding="12dp"
                    android:text="Layout8"
                    android:textColor="@color/slider3"
                    android:textSize="15sp" />
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/lin19"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="0.1dp"
                android:background="@color/slider2"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/Layout9"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginTop="2dp"
                    android:padding="12dp"
                    android:text="Layout9"
                    android:textColor="@color/slider3"
                    android:textSize="15sp" />
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/lin20"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="0.1dp"
                android:background="@color/slider2"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/_ocvcrddd"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginTop="2dp"
                    android:padding="12dp"
                    android:text="Layout10"
                    android:textColor="@color/slider3"
                    android:textSize="15sp" />
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/lin21"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="0.1dp"
                android:background="@color/slider2"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/_ordddngfgfddddd"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginTop="2dp"
                    android:padding="12dp"
                    android:text="Layout11"
                    android:textColor="@color/slider3"
                    android:textSize="15sp" />
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/lin22"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="0.1dp"
                android:background="@color/slider2"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/_orfhgdddd"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginTop="2dp"
                    android:padding="12dp"
                    android:text="Layout12"
                    android:textColor="@color/slider3"
                    android:textSize="15sp" />
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/lin23"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="0.1dp"
                android:background="@color/slider2"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/_orfghfgdddg"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginTop="2dp"
                    android:padding="12dp"
                    android:text="Layout13"
                    android:textColor="@color/slider3"
                    android:textSize="15sp" />
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/lin24"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="0.1dp"
                android:background="@color/slider2"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/Layoufgft5"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginTop="2dp"
                    android:padding="12dp"
                    android:text="Layout14"
                    android:textColor="@color/slider3"
                    android:textSize="15sp" />
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/lin25"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="0.1dp"
                android:background="@color/slider2"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/Layouhfht6"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginTop="2dp"
                    android:padding="12dp"
                    android:text="Layout15"
                    android:textColor="@color/slider3"
                    android:textSize="15sp" />
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/lin26"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="0.1dp"
                android:background="@color/slider2"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/Layoughgft7"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginTop="2dp"
                    android:padding="12dp"
                    android:text="Layout16"
                    android:textColor="@color/slider3"
                    android:textSize="15sp" />
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/lin27"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="0.1dp"
                android:background="@color/slider2"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/Layoutgfh8"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginTop="2dp"
                    android:padding="12dp"
                    android:text="Layout17"
                    android:textColor="@color/slider3"
                    android:textSize="15sp" />
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/lin28"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="0.1dp"
                android:background="@color/slider2"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/Lafgfyout9"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginTop="2dp"
                    android:padding="12dp"
                    android:text="Layout18"
                    android:textColor="@color/slider3"
                    android:textSize="15sp" />
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/lin29"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="0.1dp"
                android:background="@color/slider2"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/Lafgfyoghut9"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginTop="2dp"
                    android:padding="12dp"
                    android:text="Layout19"
                    android:textColor="@color/slider3"
                    android:textSize="15sp" />
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/lin30"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="0.1dp"
                android:background="@color/slider2"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/Ladfgfgfyout9"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginTop="2dp"
                    android:padding="12dp"
                    android:text="Layout20"
                    android:textColor="@color/slider3"
                    android:textSize="15sp" />
            </RelativeLayout>
            </LinearLayout>
            </ScrollView>
        </LinearLayout>
    </LinearLayout>
</RelativeLayout>