首页 > 代码库 > 熟悉AndroidAPI系列1——LinearLayout

熟悉AndroidAPI系列1——LinearLayout

<?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="vertical" >        <TextView         android:layout_width = "match_parent"        android:layout_height = "wrap_content"        android:background="#00FF00"        android:text = "第一个textview"/>        <TextView         android:layout_width = "match_parent"        android:layout_height = "wrap_content"        android:background="#FF0000"        android:text = "第二个textview"/></LinearLayout>
package com.njulya.firstprj;import android.os.Bundle;import android.app.Activity;import android.view.Menu;public class MainActivity extends Activity {    @Override    protected void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        setContentView(R.layout.first_layout);    }    @Override    public boolean onCreateOptionsMenu(Menu menu) {        // Inflate the menu; this adds items to the action bar if it is present.        getMenuInflater().inflate(R.menu.main, menu);        return true;    }}

 

熟悉AndroidAPI系列1——LinearLayout