Android self-paced notebook Android five layout of the linear layout of the function, common properties, usage

Source: Internet
Author: User

1. Introduction:

Linear layout Manager uses linear management of the controls or layouts in which they reside

Common Properties of 2.LinearLayout
Android:orientation = "vertical"--this property determines how the sub-class control is arranged (vertical: vertical; horizontal: Horizontal)
android:gravity = "center"--this property determines the position of the XY of its child control


Common property values
Center_vertical: Vertical (Y axis) centered
Center_horizontal: Horizontal (x axis) centered
Center: Vertical horizontal is centered
Right/left/buttom: Child controls are in the right/left/bottom of the current layout

Android:layout_gravity----The position of the current control itself and the parent control
Android:gravity---The position of the child control of the current control in the parent control
! Layout is a layout that can be applied
Gravity property: Determines the XY position of its subclasses

Gravity attributes can be used with multiple, separated by |


3. Usage

<span style= "font-family:kaiti_gb2312;" ><linearlayout xmlns:android= "http://schemas.android.com/apk/res/android"    android:orientation= " Vertical "android:layout_width=" match_parent "        android:layout_height=" match_parent ">    <button        Android:layout_width= "Match_parent"        android:layout_height= "wrap_content"        android:text= "first button"        android:id= "@+id/button_first"/>    <button        android:layout_width= "Match_parent"        android: layout_height= "Wrap_content"        android:text= "second button"        android:id= "@+id/button2"        android: layout_gravity= "Center_horizontal"/>    <textview        android:layout_width= "Match_parent"        android:layout_height= "Wrap_content"        android:text= "implement jump page function"        android:id= "@+id/textview"        Android : layout_gravity= "Center_horizontal"/></linearlayout></span>


Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Android self-paced notebook Android five layout of the linear layout of the function, common properties, usage

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.