Android learning route (20) using Fragment to build a dynamic UI and androidfragment

Source: Internet
Author: User

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 useFragmentClass 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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.