Android Development Notes (2)--viewgroup

Source: Internet
Author: User

First, ViewGroup

1, the meaning ofviewgroup --Integration Layout of multiple different View, and the location of the arrangement

2.ViewGroup Type

Linear layout is simple and straightforward, allowing horizontal placement/vertical placement only

Relative layout with complex and vivid layouts that can be set according to the relative position of the parent/child view

Second, Layout

    • Anroid URL Tag

xmlns:android= "Http://schemas.android.com/apk/res/android"

Add an XML namespace to the XML file root view, and the "Android:" symbol belongs to the Android attribute.

    • Layout parameters

Many properties, involving background, text, TextSize are handled by TextView stylized view

involved layout_width\layout_height\layout_above for layout parameters, managed by the ViewGroup Unified.

    • Linear Layout

1) only allow full horizontal/full vertical placement of the entire layout

android:orientation= "vertical"

android:orientation= "Horziontal"

2) How to achieve equal views on different device screens?

Fixed length and width x

layout_weight: Sets the length-to-width weight of each view, equal-scale placement

Rules:

1) Configure a fixed length-width,wrap_content View

2) configuration layout_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 one View setting weight, regardless of the value size, is full

b) When two or more View set weights, according to set the value, equal proportion allocation space

c) Special case: equal to all View weight values

5) when weight=0 /Not set (default = 0), theView size does not change

    • Relative Layout

1) relative to the Parent View

The entire view fits four edges, sets the Alignment property,true / false

Android:layout_alignparenttop

Android:layout_alignparentbottom

Android:layout_alignparentleft

Android:layout_alignparentright

All View added to relative layout is placed in the top left corner by default

2) Center Display

Android:centerhorizontal = "true"

Android:centervertical = "true"

With other properties, you can determine the above 8 Red Star Locations

3) View ID Name

anchor Position : Each view must be named (set ID), regardless of how other elements change, to maintain a fixed position of view, relative to the child view setting

Definition (first time use) android:id = "@ + id/ben_text_view"

Re-use:"@ id/ben_text_view"

4) relative to child View

Android:layout_toleftof = "@ Id/ben_text_view"

Android:layout_torightof

Android:layout_above

Android:layout_below

    • Padding & Margin

1) The difference between the two

A) Padding is handled by TextView and forcibly expands the original area.

b) Margin is handled by the Parent ViewGroup , maintaining the original View size and setting the "No- fly zone " outward

2) Property settings

Four weeks android:padding / android:margin

Individual (after entering individual settings, default to 0 for set parameters)

Android:paddingleft/right/top/bottom

Android:marginleft/right/top/bottom

Third,Android Studio Installation & Use

1) Android Studio is a specific platform for developing Android apps that requires the Java SDK (Java Development kit<) to be installed first /c17>)

2) Android Project

Domain--fill in the company domain name or the personal domain name

Package name -Inverted "Domain + appname " is the unique identifier that identifies the app

Android Version--different versions are named after a candy dessert.

Low version is compatible with high version, high version does not support the low version platform, for example with the latest Marshmallow, can only guarantee to use the latest version of 4.7% users download

Icecreamsandwichis often used to ensure that 97.4% users can download

3) Real Machine Walkthrough:Android Phone Open Settings, click About Mobile7 times to open Developer Mode

      -- If it is windows, you need to download OEM USB Drivers

4) Computer simulation: Using Android Emulator

--window Use Virtual Devices , System support is required Virtual Technology , and in BIOS Open in

L Birthday Greeting Card Practice Walkthrough

Android Studio View Configuration

Programming process

Android Studio View Configuration

Statement:

1, this note for text and pictures are personal original, please do not reprint

2 , the Android Development course participated in Googledeveloper for 4 years in 2017,

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

Android Development Notes (2)--viewgroup

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.