Android learning-day 6 and day 6

Source: Internet
Author: User

Android learning-day 6 and day 6

Learning Content: ListFragment component

 

==== ListFragment ====

ListFragment is a subclass of Fragment. It is used to abstract the List View (ListView). However, it uses a controller called adapter to interact with the MODEL layer!

 

The functions of the adapter are as follows:

1. create necessary view components (such as TextView)

2. Get data from the MODEL layer (main functions)

3. Provide a View to the ListView for display.

 

Generally, ArrayAdapter is used to obtain a large number of adapters. By default, ArrayAdapter <T>. getView (...) depends on the ToString () method of the specific data model class.

Text Content. If the default implementation method is not met, you can customize the content of the list project:

1. Create a new list view layout File

2. Create a subclass, inherit from ArrayAdapter, and implement necessary methods (such as the getView method)

 

In addition, the following method:

Public void onListItemClick (ListView l, View v, int position, long id)

Used to respond to user click operations

 

Fragment arguments
Similar to the information interaction mode between activities, fragment also has its own information interaction mode, which is similar to activity!

 

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.