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