Android Application Software Development (7) window layout

Source: Internet
Author: User

The following example is used to illustrate the nested use of window layout.

Note: Each layout and control must specify at least its width and height. The use of nesting is flexible and can be nested and nested.

Linearlayout and tablelayout are nested in each other to implement a more complex layout. Pay attention to the parallelism of various layout relationships and set weights.

<?xml version="1.0" encoding="utf-8"?><LinearLayout  xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_height="fill_parent"    android:layout_width="fill_parent"    android:orientation="vertical">    <LinearLayout         android:orientation="horizontal"        android:layout_height="fill_parent"        android:layout_width="fill_parent"        android:layout_weight="1">        <TextView             android:text="red"            android:background="#aa0000"            android:layout_height="fill_parent"        android:layout_width="wrap_content"            android:layout_weight="1"/>        <TextView             android:text="green"            android:background="#00aa00"            android:layout_height="fill_parent"        android:layout_width="wrap_content"            android:layout_weight="1"/>        <TextView             android:text="blue"            android:background="#0000aa"            android:layout_height="fill_parent"        android:layout_width="wrap_content"            android:layout_weight="1"/>        <TextView             android:text="yellow"            android:background="#aaaa00"            android:layout_height="fill_parent"        android:layout_width="wrap_content"            android:layout_weight="1"/>    </LinearLayout>        <LinearLayout         android:orientation="vertical"        android:layout_weight="1"        android:layout_height="fill_parent"        android:layout_width="fill_parent">        <TextView             android:text="firstRow"            android:layout_weight="1"            android:layout_width="fill_parent"        android:layout_height="wrap_content"            android:background="#00aaaa"/>        <TextView             android:text="secondRow"            android:layout_weight="1"            android:layout_width="fill_parent"        android:layout_height="wrap_content"            android:background="#aa00aa"/>        <TextView             android:text="thirdRow"            android:layout_weight="1"            android:layout_width="fill_parent"        android:layout_height="wrap_content"            android:background="#0000aa"/>    </LinearLayout></LinearLayout>

Result

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.