Crazy Android Chapter II: Adapter and some controls use

Source: Internet
Author: User

Chapter II

Focus : 1. Understanding View and the advantages and disadvantages of various layouts, applicable scenarios.

2. Master Adapter principle and usage.

3. Be familiar with the basic methods of use of other controls.

//////////////////////////////////////////

1. dynamically create and load View.

2.Develop a customView, sinceAndroidthe types of controls provided are limited and are not sufficient for some applications, such as the display of maps,Androiddoes not provide a map interface that can be displayedViewcomponent, you need a developer to build a self-fulfillingViewcomponents, usuallyViewthe base class is a blank"Paper" is a component derived from it, such asTextViewIt's on this piece of paper, in other words, the developer wants to make a display component that meets his or her own needs is usually first inheritedViewand then expand it to form your ownView. ViewThe base class provides a series of drawings orViewmethods related to the operation, such asOnDraw ();

When you create a custom View , When you import it in XML, the package path name of the class is written in more labels, for example :

<com.test.myview

Android:layout_width= "Match_parent"

.../>

3.Adapter Adapter mode,Adapter itself is an interface, General Adapter for some components to provide data, similar to the principle of charger and charging target, The phone has a mobile phone adapter, the camera has a camera adapter, and different adapters provide the corresponding data for different target components. the Adapter interface is the base class for all sub-interfaces. In most cases , a subclass derived from adapter is used for listing items to present the data.

4. Use adapter to provide datato the ListView, theListView is responsible for showing, how to display, and what content is displayed by ListView providing the data Adapter specified.

5. It is known from the inheritance that baseadapter can live the largest adapter control expansion right by inheriting the relationship . The number of list items for the program and the components of the list items can be specified by the developer.

Code See Blog Directory hands-on Android-androiddemo

Crazy Android Chapter II: Adapter and some controls use

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.