android灵活布局

如何像在jsp页面布局一样,在android界面布局

在res->layout文件夹下,新建xml文件。

在src文件中设置布局文件为刚刚新建的xml文件

android灵活布局

<?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" >
<TableLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="1"
>
<TableRow >
<TextView
android:text="ceshi"
android:id="@+id/layoutTextView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#ffff"
>
</TextView>
<EditText
android:text=""
android:id="@+id/EditText01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</TableRow>
<TableRow android:gravity="right">
<Button
android:text="test"
android:id="@+id/layoutButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</TableRow>
</TableLayout>
</LinearLayout>