What is 1,fragment? Fragment is an interface layout unit that is smaller than the activity granularity, and each fragment contains its own set of UI components, which can be seen as a miniature version of activity, each activity containing one or more fragment, 2, why do I need fragment? (meaning, function, etc.) the introduction of fragment is for the large screen of the tablet, but after the 4.0 version with the mobile phone is unified, that is, the mobile phone can also use the fragment. When an activity is split into multiple fragment, each fragment manages its own set of UI components, fragment can be dynamically combined, allowing the activity to be more flexible in interface layout 3, compared to activity? Relationship: Fragment is a smaller version of activity, one activity contains one or more fragment, each fragment embedded in an activity, fragment can be freely and dynamically combined, Can be considered a smaller than the activity granularity of the interface layout Unit difference: When the activity enters the background, it is put into the fallback stack, when the user presses the Back button, the activity can be resumed, but the fragment will not be automatically placed in the fallback stack when it enters the background. Need to explicitly call the life cycle of the Addtobackstack () method 4,fragment? Fragment experience is similar to activity, but some of the new states are fragment alone
Android Learning Record-Fragment