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); }}