Reputation: 73
Hi I had created an android app with slider menu using the link https://github.com/jfeinstein10/SlidingMenu .Nowcan you explain how to add menus to sided window and how will it load navigated page to the MainActivity. for example If I have my A activity in front I slide and choose Activity B from slide menu how will it load Activity B in front.
Also do I need to add sliding window to all activity to have navigation or is there any way to get it done for all activity from a single place.
Also How can I make actions on slided view ??
here is my code
SlidingMenu menu = new SlidingMenu(this);
menu.setMode(SlidingMenu.LEFT);
menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
menu.setShadowWidthRes(R.dimen.shadow_width);
menu.setShadowDrawable(R.drawable.shadow);
menu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
menu.setFadeDegree(0.35f);
menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
menu.setSecondaryMenu(R.layout.login);
my screen is looks as in the images
Upvotes: 1
Views: 1688
Reputation: 2317
You can do that by creating your own activity class that extends Android's activity.
create a new class, let's say you chose to name it "MyActivity", the code should look as follows
public class MyActivity extends Activity {
SlidingMenu menu;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Setup the sliding menu
menu = new SlidingMenu(this);
menu.setMode(SlidingMenu.LEFT);
menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
menu.setShadowWidthRes(R.dimen.shadow_width);
menu.setShadowDrawable(R.drawable.shadow);
menu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
menu.setFadeDegree(0.35f);
menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
}
}
then extend all your other activities from this class, for example
public class LoginActivity extends MyActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Now you can call menu
//menu.doSomething....
menu.setSecondaryMenu(R.layout.login);
}
}
Upvotes: 1
Reputation: 685
I guess you are asking for Navigation Drawer.Please refer http://developer.android.com/training/implementing-navigation/nav-drawer.html
Upvotes: 0