ANDROID_MARS学习笔记_S01_003layout初步

一、layout介绍

二、测试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);

 

  

 

posted @ 2016-02-07 10:04  shamgod  阅读(175)  评论(0编辑  收藏  举报
haha