2015/8/19/FramLayout/TableLayout/AbsoluteLayout

FrameLayout

TableLayout

AbsoluteLayout

FrameLayout

1.FrameLayout最重要的一点是可以叠加
2.FramLayout中android:visibility=”“;有三种属性分别是gone(消失)、visible(默认为可见的)、invisible(不可见但是任然占用位置)

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

    <Button
        android:layout_width="150dp"
        android:layout_height="150dp"
        android:background="#ff0000"

        />
    <Button
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:background="#ff0000ff"
        />

</FrameLayout>

TableLayout

1.TableLayout属于行和列形式的管理控件,每行为一个TableRow对象,也可以是一个View对象
2.在TableRow中还可以继续添加其他的控件,每添加一个子控件就称为一列。TableLayout不会生成边框
3.属性 android:collapseColumns :设置指定的列为collapse,如果一列被标记为collapse,该列会被隐藏
4.属性 android:shrinkColumns:设置指定的列被标示为shrinkable,列的宽度进行收缩,自适应父容器的大小
5.属性 android:stretchColumns:设置指定的列为stretchable,如果一列被标示为stretchable,该列会被拉伸,填充满表格的空白区域

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


    <TableRow>
        <Button android:text="button11111111111111111111111111111111"/>
        <Button android:text="button2"/>
        <Button android:text="button3"/>
    </TableRow>
    <TableRow>
        <Button android:text="button1"/>
        <Button android:text="button2"/>
        <Button android:text="button3"/>
    </TableRow>
    <TableRow>
        <Button android:text="button1"/>
        <Button android:text="button2"/>
        <Button android:text="button3"/>
    </TableRow>
</TableLayout>


AbsoluteLayout布局是最简单的布局模式Android中一般不用,(不具备自适应能力),就是简单粗暴的方式,用拖拉的方式进行布局

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

    >

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="New Button"
        android:id="@+id/button2"
        android:layout_x="21dp"
        android:layout_y="23dp" />

    <Button
        style="?android:attr/buttonStyleSmall"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="New Button"
        android:id="@+id/button3"
        android:layout_x="86dp"
        android:layout_y="99dp" />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="New Button"
        android:id="@+id/button4"
        android:layout_x="139dp"
        android:layout_y="191dp" />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="New Button"
        android:id="@+id/button5"
        android:layout_x="245dp"
        android:layout_y="302dp" />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="New Button"
        android:id="@+id/button6"
        android:layout_x="59dp"
        android:layout_y="366dp" />
</AbsoluteLayout>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值