Android refresher two Fragment

A, Fragment Why is known as the fifth largest components

Two, Fragment life cycle

Communication between the three, Fragment

Four, Fragment Manager: FragmentManager

 

Why a Fragment can be called fifth-largest component

  API Android 3.0 introduced the beginning, Fragment English translation of the meaning of debris. Also you can treat it as child controls Activity using the Activity Fragment are inside, affected by the Activity life cycle. Of course, it itself has its own life cycle. Android 3.0 Fragment introduced original intention was to adapt the tablet, but in the actual development, the developer is gradually excavated more Fragment of use, such as with TabLayout + ViewPager for paging management. Therefore, the Fragment become the fifth largest of the four components outside of the components can not be overemphasized.

Two Fragment loaded into two ways of Activity

Dynamic loading

Three Fragment communication

 1, call the method getActivity Activity in the Fragment in

2, call the Fragment in the Activity Interface callback method

3, call the method findFragmentById Fragment in the Fragment in

 

Four fragment of replace, add, remove method

 

Guess you like

Origin www.cnblogs.com/qiangge-python/p/10992062.html