您的位置:首页 > 移动开发 > Android开发

android中一些简单的布局

2015-06-02 16:17 483 查看


布局码如下

<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:shrinkColumns="0,1,2,3">
<TableRow>
<Button android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="按扭1"
android:layout_column="0"
/>
<Button android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="按扭2"
android:layout_column="1"
/>
</TableRow>
<TableRow>
<Button android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="按扭3"
android:layout_column="1"
/>
<Button android:id="@+id/button4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="按扭4"
android:layout_column="2"
/>
</TableRow>
<TableRow>
<Button android:id="@+id/button5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="按扭5"
android:layout_column="2"
/>
</TableRow>
<TableRow >
<Button android:id="@+id/button6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="按扭6"
android:layout_column="3" /></TableRow>
</TableLayout>





<?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" >

<Button

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:text="@string/button1"

android:layout_weight="1"

android:id="@+id/button"

/>

<LinearLayout

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:orientation="horizontal"

android:layout_weight="1" >

<Button

android:layout_width="match_parent"

android:layout_height="match_parent"

android:layout_weight="1"

android:text="@string/button2" />

<Button

android:layout_width="match_parent"

android:layout_height="match_parent"

android:layout_weight="1"

android:text="@string/button3" />

</LinearLayout>

</LinearLayout>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: