Android Development notes (2) -- ViewGroup, androidviewgroup

Source: Internet
Author: User

Android Development notes (2) -- ViewGroup, androidviewgroup

1. ViewGroup

1,ViewGroupSignificance-IntegrationLayoutMultiple differencesViewAnd arrange its locations

 

2,ViewGroupType

Linear LayoutSimple and Direct layout format, only horizontal/vertical placement is allowed

Relative LayoutComplex and vivid layout format, which can be set based on the relative location of parent/child View

 

 

Ii. Layout

  • Anroid URL tag

Xmlns: android = "http://schemas.android.com/apk/res/android"

Add the XML namespace and"Android:"Indicates that it belongs to the android attribute.

 

  • Layout Parameters

Among many attributesBackground, text, textSizeByTextViewStylized view processing

InvolvedLayout_width\Layout_height\Layout_abveIs the layout parameterViewGroupUnified management.

  • Linear Layout

1) only full horizontal/full vertical layout is allowed

Android: orientation = "vertical"

Android: orientation = "horziontal"

2) How does one achieve an equal view score on different device screens?

Fixed length and width ×

Layout_weight:Set the length, width, and other proportions of each View.

Rules:

1) fixed length and width,Wrap_contentOfView

2) ConfigurationLayout_weight

Android: layout_width = "0dp"

Android: layout_weight = "1"

3) Calculate the remaining space

4) Allocate the remaining space (Full)

A) when there is only oneViewSet the weight, regardless of the value size, all full

B) When two or moreViewSet the weight and allocate space according to the set value and other proportions.

C) Special Case: Equal score-ensure allViewEqual weight

5) whenWeight = 0/When it is not set (the default value is 0,ViewSize unchanged

 

 

  • Relative Layout

1) relativeParent View

The entire view is attached to four sides and the alignment attribute is set,True/False

Android: layout_alignParentTop

Android: layout_alignParentBottom

Android: layout_alignParentLeft

Android: layout_alignParentRight

All joinRelative layoutOfViewIt is placed in the upper left corner by default.

 

2) center display

Android: centerHorizontal = "true"

Android: centerVertical = "true"

Combine other attributes to determine the above8 red stars

3)View IDName

Positioning: No matter how other elements change, maintain a fixed position View. To set the Child View, you must name each View (set the ID)

Definition (used for the first time) Android: id = "@ + id/ben_text_view"

Reuse:"@ Id/ben_text_view"

4) relativeChild View

Android: layout_toLeftof = "@ id/ben_text_view"

Android: layout_toRightof

Android: layout_abve

Android: layout_below

 

 

  • Padding & Margin

1) Differences

A)PaddingByTextViewHandle and forcibly expand the original area

B)MarginByParent ViewGroupProcess and maintain the originalViewSize, set"No-fly zone"

 

2) attribute settings

Four weeksAndroid: padding/android: margin

Independent (after entering the separate settings, the default value of the Set parameter is 0)

Android: paddingLeft/Right/Top/Bottom

Android: marginLeft/Right/Top/Bottom

 

 

III,Android StudioInstall and use

1)Android StudioIs specific for developmentAndroid appsThe application platform must be installed first.JavaDevelopment Kit (Java Development Kit)

2)Android Project

Domain-- Enter the Company domain name or personal domain name

Package name-- Invert"Domain + appnameIs to identify thisAppUnique id

AndroidVersion-different versions are named after Candy desserts

The earlier version is compatible with the later version. The later version does not support the earlier version platform. For example, the latest version is used.MarshmallowOnly 4.7% users of the latest version can be used for download.

Commonly usedIcecreamSandwichTo ensure that 97.4% of users can download

 

3) Real-machine drills:Android PhoneOpen settings and clickAbout mobileOpen 7 timesDeveloper Mode

      --For WINDOWS, download the oem usb Drivers

4) Computer Simulation: UseAndroid Emulator

-- WINDOWUseVirtual Devices, Requires system supportVirtual Technology, AndBIOSOpen

 

 

L birthday card practice drills

Android Studio view Configuration

 

 

Procedure

 

Android Studio view Configuration

 

 

Statement:

1. The text and pictures in this note are both original and do not reprint them.

2. the Android Development Course was attended by Google developer for four years in 2017,

Notes http://www.studyjamscn.com/thread-19454-1-1.html

 

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.