If here I We want to imitate the effect similar to the return stack, press the Back key to return to the previous fragment, how to achieve it? It’s actually very simple. In the previous section, we successfully implemented the function of dynamically adding Android Fragments to the activity, but if you try it, it will be posted Now, after adding a fragment by clicking the button, the program will exit directly by pressing the Back key. Simulate the return stack in the fragment: Then click the button, the effect is shown in Figure7. Re-run the program and you can see the same boundary as before. This completes the function of dynamically adding Android Fragments to the activity.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |