ANDROID_MARS学习笔记_S01_003layout初步

时间:2023-01-05 12:28:50

一、layout介绍

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

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