一、layout介绍

ANDROID_MARS学习笔记_S01_003layout初步_ideANDROID_MARS学习笔记_S01_003layout初步_Android_02

二、测试linear_layout
1.activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal" >
    <TextView 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="#ff0000"
        android:text="第一个"/>
    <TextView 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="#0000ff"
        android:text="第二个"/>

</LinearLayout>

  

2.MainActivity.java

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //setContentView(R.layout.activity_main);
        setContentView(R.layout.first_layout);

 

  

 

You can do anything you set your mind to, man!