android 关于表格布局的认识

表格布局(TableLayout)

使用的知识点有:

控件

TableRow:为这个表格添加一行

table的特殊属性

android:layout_column:确定此表格的列数

android:stretchColumns:确定拉伸的列

android:shrinkColumns:确认压缩的列

table中控件可添加的属性

android:layour_column:指定此控件具体的位置

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
     android:stretchColumns="2">
    <TableRow
        android:id="@+id/tableRow1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >
        <Button
            android:id="@+id/button1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Button" />
        <Button
            android:id="@+id/button2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Button" />
    </TableRow>
    <TableRow
        android:id="@+id/tableRow2"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <Button
            android:id="@+id/button3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_column="1"
            android:text="Button" />
        <Button
            android:id="@+id/button4"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_column="2"
            android:text="Button" />
    </TableRow>
    <TableRow
        android:id="@+id/tableRow3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >
        <Button
            android:id="@+id/button5"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_column="2"
            android:text="Button" />
    </TableRow>
</TableLayout>

上述布局的代码

时间: 2024-08-03 03:14:23

android 关于表格布局的认识的相关文章

从零开始学android&lt;Tablelayout表格布局.十五.&gt;

TableLayout就是将手机的屏幕分为一行行的形式进行数据的显示,并且一行可以多个控件 并且可以设置控件的对齐方式,和是否为可收缩行 下面通过一行图和一个简单的例子来看看Tablelayout布局的使用 ----------------------毫无美感的分割线---------------------- 单独使用xml文件进行配置 <?xml version="1.0" encoding="utf-8"?> <TableLayout xml

Android基础_2 Activity线性布局和表格布局

在activity的布局中,线性布局和表格布局是最简单的,这次分别从线性布局,表格布局以及线性布局和表格混合布局做了实验,实验中只需要编写 相应的xml的代码,java代码不需要更改,因为我们这里只是练习android的界面设计.参考的资料为mars老师的教程. 线性布局: 线性布局就是将各种控件按照行或者列依次进行排列. 其中本实验用到的各控件的属性解释如下: android:layout_weight属性是指不同的控件在activity中占有体积大小的比例. android:paddingL

android表格布局

1 <?xml version="1.0" encoding="utf-8"?> 2 <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 android:layout_width="match_parent" 4 android:layout_height="match_parent" >

Android表格布局之设置边框

Android表格布局本身没有边框,不过可以通过背景色的设置可以实现表格边框的显示. 首先可以设置TableRow的背景色,然后设置内容的背景色.根据它们的颜色差就出现了边框.只要微调Content与TableRow的margin和pading属性就可以了! 调的过程真是烦人!下次不做这种工作了~呜呜!难受! 贴上布局代码: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xml

android——相对布局,表格布局

1.相对布局 RelativeLayout 又称作相对布局,也是一种非常常用的布局.和LinearLayout 的排列规则不同,RelativeLayout 显得更加随意一些,它可以通过相对定位的方式让控件出现在布局的任何位置.也正因为如此,RelativeLayout 中的属性非常多,不过这些属性都是有规律可循的,其实并不难理解和记忆. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android&qu

Android——布局(线性布局linearLayout,表格布局TableLayout,帧布局FrameLayout)

线性布局: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent&q

Android布局之表格布局TableLayout

一.TableLayout概述 TableLayout表格布局模型以行列的形式管理子控件,每一行为一个TableRow的对象,当然也可以是一个View的对象 二.TableLayout的全局属性  android:collapseColumns = "1,2"      隐藏从0开始索引列,列直接必须ongoing逗号隔开:1,2,5 android:shrikColumns = "1,2"       收缩从0开始的索引列.当可收缩的列太宽(内容过多)不会被挤出屏

安卓表格布局android:collapseColumns,android:shrinkColumns和stretchColumn

TableLayout的行数由开发人员直接指定,即有多少个TableRow对象(或View控件),就有多少行. TableLayout的列数等于含有最多子控件的TableRow的列数.如第一TableRow含2个子控件,第二个TableRow含3个,第三个TableRow含4个,那么该TableLayout的列数为4. TableLayout可设置的属性包括全局属性及单元格属性. 1.全局属性也即列属性,有以下3个参数: android:stretchColumns    设置可伸展的列.该列可

Android笔记(九) Android中的布局——表格布局

TableLayout运行我们使用表格的方式来排列控件,它的本质依然是线性布局.表格布局采用行.列的形式来管理控件,TableLayout并不需要明确的声明包含多少行多少列,而是通过添加TableRow.其他组件来控制表格的行数和列数. 每次向Table中添加一个TableRow,该TableRow就是一个表格行,TableRow也是容器,因此它也可以不断的添加其他组件,每添加一个子组件该表格就增加一列. 实例代码,实现一下简单的登录界面 tablelayout.xml <?xml versio