LinearLayout of Android UI Layout

Source: Internet
Author: User

LinearLayout of Android UI Layout
LinearLayout is one of the most common layout s in Android. It lists its child elements in one direction. The direction can be either horizontal or vertical. In this direction, you can set android: orientation = "vertical" or android: orientation = "horizontal". All elements are arranged one by one. For vertical arrangement, the LinearLayout elements are arranged one by one from top to bottom. For example, in the following example, the MainActivity view is arranged one by one vertically. For horizontal arrangement, the child elements in LinearLayout are arranged one by one from left to right.


Instance: LayoutDemo

Running effect:


Code List: <喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> Vc3ryb25np1_vcd4ksry + 1s7EvP6jum1haW4ueG1sPGJyPgo8cHJlIGNsYXNzPQ = "brush: java;">

Java source code file: MainActivity. java

package com.rainsong.layoutdemo;import android.app.Activity;import android.os.Bundle;public class MainActivity extends Activity{    /** Called when the activity is first created. */    @Override    public void onCreate(Bundle savedInstanceState)    {        super.onCreate(savedInstanceState);        setContentView(R.layout.main);    }}


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.