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

Android学习笔记之android:collapseColumns,android:shrinkColumns和stretchColumn

2013-11-25 14:23 393 查看
TableLayout是一个使用复杂的布局,最简单的用法就仅仅是拖拉控件做出个界面,但实际上,会经常在代码里使用TableLayout,例如做出表格的效果。本文主要介绍TableLayout的基本使用方法。

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

>

<TableRow>

<Button

android:id="@+id/button1"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="Button1"

android:layout_column="0"/>

<Button

android:id="@+id/button2"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="Hello, I am a Button2"

android:layout_column="1"/>

</TableRow>

</TableLayout>

www.2cto.com



1 android:stretchColumns = "指定的列" ------->以第0行为序,尽量把指定的列填充空白部分

设置stretchColumns=0,则结果如下图,第0列被尽量填充

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