GitHub - tinypeter/Android_SlideMenu | Latest TMZ Celebrity News & Gossip | Watch TMZ Live
Skip to content

tinypeter/Android_SlideMenu

 
 

Repository files navigation

Android_SlideMenu

##Requirements

  • Android 2.3 (Gingerbread) and above

##Introduction The slidemenu works like the facebook or google plus slide menu. the content layout slides out and the menu slides in from which direction u want (TOP / BOTTOM / LEFT / RIGHT).

##Example The SlideMenu library is really easy to use. First we generate our Layout

For Example:

<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"
tools:context=".MainActivity" >
<!-- navigation menu -->
<FrameLayout
    android:id="@+id/slidemenu"
    android:background="@android:color/black"
    android:layout_width="250dp"
    android:layout_height="fill_parent"
    android:layout_alignParentLeft="true">
</FrameLayout>
<!-- content -->
<RelativeLayout 
    android:id="@+id/content"
    android:background="@android:color/white"
    android:clickable="true"
    android:onClick="hideSideMenu"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
</RelativeLayout>

The next step is to define the layouts in our SlideMenu class

public class MainActivity extends Activity {

private SlideMenu menu;
private ImageView img;

@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_main);
	img = (ImageView) this.findViewById(R.id.img);

	FrameLayout slideMenu = (FrameLayout) findViewById(R.id.slidemenu);

	RelativeLayout content = (RelativeLayout) findViewById(R.id.content);

	try {
		menu = new SlideMenu(slideMenu, content);
	} catch (Exception e) {
		e.printStackTrace();
	}

}

public void showSlideMenu(View v) {
	try {
		// setDuration and setSlideOrientation are optional. The default values are
		// duration = 100 and slideOrientation from LEFT
		menu.setDuration(1000);
		menu.setSlideOrientation(SlideMenu.SLIDE_LEFT);
		menu.slideIn();
	} catch (Exception e) {

	}
}

public void hideSlideMenu(View v) {

	try {
		menu.slideOut();
	} catch (Exception e) {
		e.printStackTrace();
	}

}

Now bind the showSlideMenu and hideSlideMenu method to an button or an other view.

If you should slide in from top or bottom then you must set ur FrameLayout to Bottom or Top.

That's all !

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

TMZ Celebrity News – Breaking Stories, Videos & Gossip

Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

🎥 Watch TMZ Live

TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.