简体   繁体   中英

Replace screen content in Android with a ListActivity

To replace the screen content with different fragments I use this code

       getActivity().getSupportFragmentManager().beginTransaction()
            .replace(R.id.container, new MainActivityTest())
            .addToBackStack(null).commit();

What's the code to replace with a ListActitivy instead of a fragment? I was using Intent, but I want the menu to still show since I have a navigation drawer built in. Thanks!

The navigation drawer and action bar are part of the activity, by replacing it, they would be removed/recreated anyway. You can show multiple activities inside another one but doing that is long deprecated. Use ListFragment .

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