android 类型

1.GridLayout布局
    此布局是实现网格布局
    rowCount="num"----num是具体数值,是网格的行数
    columnCount="num"---同上,实现网格的列数
    
    1>layout_columnSpan="num"同上,实现网格列的合并
        layout_rowCount="num"同上,实现网格行的合并

        合并时要用到layout_gravity="fill"

<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:rowCount="7"
    android:columnCount="4">
    <TextView
       android:layout_columnSpan="4"
        android:text="0"
        android:textSize="@dimen/font32"
        android:layout_row="1"
        android:layout_column="0" />

    <EditText
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:inputType="time"
        android:ems="10"
        android:id="@+id/editText3"
        android:layout_row="0"
        android:layout_column="2" />

    <Button

        android:text="1"
        android:textSize="20sp"
        android:layout_margin="5dp"
        android:background="@color/colorAccent"
        android:layout_row="2"
        android:layout_column="0" />
    <Button
        android:text="2"
        android:textSize="20sp"
        android:layout_margin="5dp"
        android:background="@color/colorAccent"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_row="2"
        android:layout_column="1" />
    <Button
        android:text="3"
        android:textSize="20sp"
        android:layout_margin="5dp"
        android:background="@color/colorAccent"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_row="2"
        android:layout_column="2" />
    <Button
    android:text="+"
    android:textSize="20sp"
        android:layout_margin="5dp"
    android:background="@color/colorAccent"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
        android:layout_row="2"
        android:layout_column="3" />
    <Button
        android:text="4"
        android:textSize="20sp"
        android:layout_margin="5dp"
        android:background="@color/colorAccent"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_row="3"
        android:layout_column="0" />
    <Button
    android:text="5"
    android:textSize="20sp"
        android:layout_margin="5dp"
    android:background="@color/colorAccent"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
        android:layout_row="3"
        android:layout_column="1" />

    <Button
        android:text="6"
        android:textSize="20sp"
        android:layout_margin="5dp"
        android:background="@color/colorAccent"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_row="3"
        android:layout_column="2" />
    <Button
        android:text="-"
        android:textSize="20sp"
        android:layout_margin="5dp"
        android:background="@color/colorAccent"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_row="3"
        android:layout_column="3" />
    <Button
        android:text="="
        android:textSize="20sp"
        android:layout_margin="5dp"
        android:layout_rowSpan="2"
        android:layout_gravity="fill"
        android:background="@color/colorAccent"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_row="4"
        android:layout_column="0" />
    <Button
        android:text="7"
        android:textSize="20sp"
        android:layout_margin="5dp"
        android:background="@color/colorAccent"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_row="4"
        android:layout_column="1" />
    <Button
        android:text="8"
        android:textSize="20sp"
        android:layout_margin="5dp"
        android:background="@color/colorAccent"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_row="4"
        android:layout_column="2" />
    <Button
        android:text="*"
        android:textSize="20sp"
        android:layout_margin="5dp"
        android:background="@color/colorAccent"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_row="4"
        android:layout_column="3" />
    <Button
        android:text="9"
        android:textSize="20sp"
        android:layout_margin="5dp"
        android:background="@color/colorAccent"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_row="5"
        android:layout_column="1" />
    <Button
        android:text="0"
        android:textSize="20sp"
        android:layout_margin="5dp"
        android:background="@color/colorAccent"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_row="5"
        android:layout_column="2" />
    <Button
        android:text="\"
        android:textSize="20sp"
        android:layout_margin="5dp"
        android:background="@color/colorAccent"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_row="5"
        android:layout_column="3" />

</GridLayout>

2.FrameLayout 单帧布局
    单帧布局结构简单,所有子元素部分覆盖或全部覆盖前面的元素,而且都位于左上角
3.AbsoluteLayout 绝对位置布局
    以屏幕上的左上角为原点(0,0),横的为X,纵的为Y,都为正值。子元素可以相互重叠,适配性不好,较少使用
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值