Android development and design learning, Android Development and Design

Source: Internet
Author: User

Android development and design learning, Android Development and Design

3. Common UI Layout

1). LinearLayout: Linear Layout
Used to control the display of its subviews in horizontal or vertical mode.
2). RelativeLayout: relative Layout
Used to control its subviews for layout display in relative positioning Mode
3). FrameLayout: frame Layout
Each sub-View represents a screen, and the subsequent View will overwrite the previous screen.
The android: layout_gravity attribute of the sub-View is used to indicate the position of the sub-View.

4. Attributes of common view labels

1). Common view attributes

2). Only for RelativeLayout


3). Only for LinearLayout

5. Use of ListView

1). Understanding


2). Use
A. ArrayAdapter: displays the simple text list.

B. SimpleAdpater: display the complex list

C. BaseAdpater (abstract): displays a complex list
Int getCount (): obtains the number of data sets and determines how many rows can be displayed.
Object getItem (int position): obtains the corresponding data Object based on position.
View getView (int position, View convertView, ViewGroup parent)
// Return the corresponding Item view object with data according to position
Position: subscript
ConvertView: Reusable Item view object
Null: No reusable items. We must load an item layout file and assign it to convertView.
Not null: directly use this view object
Next: Find the sub-View, find the corresponding data, and set the data
Parent: ListView
D. Set a listener for the ListView Item
Item click listening: listView. setOnItemClickListener (listener)
Item long-pressed listener: listView. setOnItemLongClickListener (listener)
3). Optimization
A. a maximum of n + convertView objects exist in the memory.
B. The layout file of the item is loaded only when convertView is null.

6. style and Theme

1). style: a set of multiple view label attributes
Benefit: Reuse tag attributes
Objective: To view labels in the layout File
2). theme: The essence is also style.
Benefit: Reuse tag attributes
Objective: To view the entire application/Activity in the function list file

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.