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

android 类型

2016-05-20 21:19 519 查看
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,都为正值。子元素可以相互重叠,适配性不好,较少使用
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: