zoukankan      html  css  js  c++  java
  • 相对布局和网格布局

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout 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="按钮"
            android:layout_alignParentLeft="true"/>
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="按钮"
            android:layout_alignParentRight="true"/>
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="按钮"
            android:layout_alignParentLeft="true"
            android:layout_alignParentBottom="true"/>
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="按钮"
            android:layout_alignParentRight="true"
            android:layout_alignParentBottom="true"/>
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="按钮"
            android:layout_centerInParent="true"
            android:id="@+id/bt_center"/>
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="按钮"
            android:layout_centerHorizontal="true"/>
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="按钮"
            android:layout_centerHorizontal="true"
            android:layout_alignParentBottom="true"/>
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="按钮"
            android:layout_centerVertical="true"/>
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="按钮"
            android:layout_centerVertical="true"
            android:layout_alignParentRight="true"/>
    
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="新按钮"
            android:layout_alignBottom="@id/bt_center"
            android:layout_toLeftOf="@id/bt_center"/>
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="新按钮"
            android:layout_alignTop="@id/bt_center"
            android:layout_toRightOf="@id/bt_center"/>
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="新按钮"
            android:layout_above="@id/bt_center"
            android:layout_alignLeft="@id/bt_center"/>
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="新按钮"
            android:layout_below="@id/bt_center"
            android:layout_alignRight="@id/bt_center"/>
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="新按钮"
            android:layout_below="@id/bt_center"
            android:layout_toLeftOf="@id/bt_center"/>
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="新按钮"
            android:layout_below="@id/bt_center"
            android:layout_toRightOf="@id/bt_center"/>
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="新按钮"
            android:layout_above="@id/bt_center"
            android:layout_toRightOf="@id/bt_center"/>
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="新按钮"
            android:layout_above="@id/bt_center"
            android:layout_toLeftOf="@id/bt_center"/>
    
    </RelativeLayout>
    View Code

    <?xml version="1.0" encoding="utf-8"?>
    <GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:rowCount="3"
        android:columnCount="4"
        android:padding="10dp">
    
        <Button
            android:text="按钮1"
            android:layout_row="0"
            android:layout_column="1"
            android:layout_columnSpan="1"
            android:layout_gravity="fill"
            android:layout_columnWeight="1"
            android:layout_rowWeight="1"/>
        <Button
            android:text="按钮2"
            android:layout_row="0"
            android:layout_column="0"
            android:layout_rowSpan="1"
            android:layout_gravity="fill"
            android:layout_columnWeight="1"/>
        <Button
            android:layout_gravity="fill"
            android:text="按钮3"
            android:layout_columnWeight="1"/>
        <Button
            android:layout_gravity="fill"
            android:text="按钮4"
            android:layout_columnWeight="1"/>
        <Button
            android:layout_gravity="fill"
            android:text="按钮5"
            android:layout_columnWeight="1"
            android:layout_rowWeight="1"/>
        <Button
            android:layout_gravity="fill"
            android:text="按钮6"
            android:layout_columnWeight="1"/>
        <Button
            android:layout_gravity="fill"
            android:text="按钮7"
            android:layout_columnWeight="1"/>
        <Button
            android:layout_gravity="fill"
            android:text="按钮8"
            android:layout_columnWeight="1"/>
    
    </GridLayout>
    View Code

  • 相关阅读:
    mysql数据库管理工具(navicat for mysql)
    一次测试岗位针对Java和接口的面试题
    接口测试 rest-assured 使用指南
    简单实现接口自动化测试(基于python+unittest)
    负载测试、压力测试和性能测试的异同
    【Excle数据透视表】如何新建数据透视表样式
    【Excle数据透视表】如何为数据透视表应用样式
    【Linux】Linux删除指定文件夹下面 名称不包含指定字符的文件
    【Excle数据透视表】如何水平并排显示报表筛选区域的字段
    【Excle数据透视表】如何在数据透视表中使用合并单元格标志
  • 原文地址:https://www.cnblogs.com/bilibiliganbei/p/5414638.html
Copyright © 2011-2022 走看看