Android learning route (20) using Fragment to build a dynamic UI and androidfragment
To create a dynamic or multi-panel user interface on the Android system, you need to encapsulate the UI components and activity behavior into modules, it allows you to flexibly switch between display and hide in your activity. You can useFragment
Class to create these modules. They can behave like nested activities. They define their own la S and manage their own lifecycles.
When a fragment specifies its own layout, it can be configured as different combinations in the activity and other fragment, in this way, you can modify the layout configuration for different screen sizes (one fragment is displayed at a time on a small screen, and two or more are displayed at a time on a large screen ).
This course shows you how to use fragment to create a dynamic user experience, optimize the user experience of your applications on devices of different screen sizes, and support Android 1.6.
Course
-
Create a Fragment
-
Learn how to build a fragment and use its callback to implement the Basic Behavior of fragment.
-
Build a flexible UI
-
Learn how to build a layout that provides different fragment configurations for your applications on different screens.
-
Communication between Fragments
-
Learn how to set a path for fragment to communicate with activity and other fragments.
In the android layout file, what is the effect of using class = "comexampleandroidwifidirectDeviceListFragment?
Deploy a fragment. The specific function is related to the implementation.
Fragment is mainly used to dynamically manage the UI and adapt to devices with different resolutions.
How does Android dynamically add fragment to any position in the layout?
We usually use
Getsuppfrfragmentmanager (). beginTransaction (). replace (R. id. fragment_view, fragment). commit ();
To add fragment to the specified view position. Therefore, you only need to dynamically change the position of the view to be replaced, and the replacement process remains unchanged.
Dynamically change the view location, which requires you to dynamically set the view location in the java code.