Seventh operations --fragment

Fragment, referred to as fragments, is Android 3.0 (API 11 ) proposed to be compatible with low version, support-v4 library also developed a Fragment API, the minimum compatible with Android 1.6 . 
Fragment Activity is dependent on, and can not exist independently. 
Activity in a can have multiple Fragment. 
Fragment may be reused a plurality Activity. 
Fragment has its own life cycle, and can receive input events. 
We can dynamically add or delete Fragment Activity at runtime. 
Modular (Modularity): We all do not have to write all the code in an Activity, but to write the code in their respective Fragment in. 
Reusable (Reusability): Activity can be reused a plurality of Fragment. 
May be adapted (Adaptability): According to the hardware screen size, screen orientation, can easily realize different layout, so that a better user experience. 
onAttach (): Called when Fragment and associated Activity. Activity may be obtained by reference to the method, may further () Gets parameters getArguments. 
onCreate (): Fragment call when they are created. 
onCreateView (): Fragment of creating a layout. 
onActivityCreated (): Called when the Activity is completed onCreate ().
onStart (): Called when the Fragment visible. 
onResume (): Called when Fragment visible and interactive. 
onPause (): Fragment interaction but not visible when calling. 
onStop (): Called when the Fragment is not visible. 
onDestroyView (): Fragment call when a UI is removed from view the structure. 
onDestroy (): Called when the destruction of Fragment. 
onDetach (): Called when disassociated Activity and Fragment.

 

Guess you like

Origin www.cnblogs.com/jinlingling/p/11756096.html