简体   繁体   中英

How to handle multiple activities with fragments?

I need to implement an app through fragments.

Based on my requirements,i have a menu panel one side and other side i need to display different ui screens based on menu selection.

My Screen contains heavy ui.That why i design each screen separately.

How should i display screens based on menu selections through fragments.

If any one know the solution,Please help me

Thanks in advance.

If you mean the NavigationDrawer you find the official Tutorial on the Android Developers Website

There is also an example to download, which uses the NavigationDrawer to switch Fragments.

If you want a fixed, self-designed Menu and just want to swap out Fragments (holded by a FrameLayout) check out this Tutorial

Android officially doesn't provide more than one sliding menus (navigation drawers). You can implement SlideMenu or choose one of many such libraries for more than one sliding menus.

Once the menus are implemented, it's just a simple case of fragments and activities. There is no "direct way". Read the documentation and understand how they work. Here are some good links

Fragments - Introduction on developer site

Tutorial on multi-pane development using fragments by Mr. Vogel

Basically what you have to do is, create an Activity extending ActionBarActivity (from support library) or FragmentActivity . create fragments and replace them in FragmentManager from your main activity.

See this for reference:

Creating a navigation drawer

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM