Android page layout [soft technology]

Source: Internet
Author: User

Android systems can be deployed in the following ways:

1. LinearLayout-linear Layout

Yes. All components on the page are laid in a linear layout,

Vertical:

Android: orientation = "vertical" indicates to form a vertical column;

Horizontal level:

Android: orientation = "horizontal"

<? Xml version = "1.0" encoding = "UTF-8"?>
<LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android"
Android: orientation = "horizontal"
Android: layout_width = "fill_parent"
Android: layout_height = "fill_parent"
>
<TextView
Android: layout_width = "fill_parent"
Android: layout_height = "wrap_content"
Android: text = "@ string/mobile"
Android: id = "@ + id/cancelable"
/>
<EditText
Android: layout_width = "fill_parent"
Android: layout_height = "wrap_content"
Android: id = "@ + id/mobilenumer"
/>
<TextView
Android: layout_width = "fill_parent"
Android: layout_height = "wrap_content"
Android: text = "@ string/smslable"
Android: id = "@ + id/smslable"
/>
<EditText
Android: layout_width = "match_parent"
Android: layout_height = "wrap_content"
Android: minLines = "3"
Android: id = "@ + id/messages"
/>
<Button
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: text = "@ string/send_button"
Android: id = "@ + id/sms_button"
/>
</LinearLayout>

 


 

 

2. AbsoluteLayout-absolute Layout

Layout Method:

1) define an id for each component, for example, a component: android: id = "@ + id/linearlayout"

2) For example, if another component is located at the bottom of the component, set it to android: layout_below = "@ id/linearlayout" in the group"

3) to the right of the parent control: android: layout_alignParentRight = "true"

There are other usage methods, such as: on the left side of the parent control.

 

In fact, the layout of android is similar to that of table in Html. It can also be nested with labels.

<? Xml version = "1.0" encoding = "UTF-8"?>
<RelativeLayout xmlns: android = "http://schemas.android.com/apk/res/android"
Android: layout_width = "fill_parent"
Android: layout_height = "fill_parent"
>
<LinearLayout
Android: orientation = "horizontal"
Android: layout_width = "fill_parent"
Android: layout_height = "wrap_content"
Android: id = "@ + id/linearlayout"
>
<TextView
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: textSize = "18sp"
Android: text = "@ string/mobile"
Android: id = "@ + id/cancelable"
/>
<EditText
Android: layout_width = "fill_parent"
Android: layout_height = "wrap_content"
Android: layout_toRightOf = "@ id/cancelable"
Android: id = "@ + id/mobilenumer"
/>
</LinearLayout>
<TextView
Android: layout_width = "fill_parent"
Android: layout_height = "wrap_content"
Android: layout_below = "@ id/linearlayout"
Android: textSize = "18sp"
Android: text = "@ string/smslable"
Android: id = "@ + id/smslable"
/>
<EditText
Android: layout_width = "match_parent"
Android: layout_height = "wrap_content"
Android: layout_below = "@ id/smslable"
Android: minLines = "3"
Android: id = "@ + id/messages"
/>
<Button
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: layout_below = "@ id/messages"
Android: layout_alignParentRight = "true"
Android: text = "@ string/send_button"
Android: id = "@ + id/sms_button"
/>
</RelativeLayout>

 


 

3. RelativeLayout (relative layout)

4. TableLayout (table layout) and FrameLayout (frame layout)

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.