zoukankan      html  css  js  c++  java
  • Ardroid 常见界面布局

    1.相对布局RelativeLayout

    1.1 相对父容器布局

    android:layout_width="match_parent(充满父)/wrap_content(根据本身)"    控件的宽度

    android:layout_height=match_parent/wrap_content""   控件的高度

    android:layout_alignParentTop="true/false"   是否顶对齐

    android:layout_marginTop="30dp"  控件与父容器上边的距离

    android:layout_alignParentBottom="true/false"   是否底对齐

    android:layout_marginBottom="30dp"    下边的距离

    android:layout_alignParentLeft="true/false"    是否左对齐

    android:layout_marginLeft="30dp"       左边的距离

    android:layout_alignParentRight="true/false"    是否右对齐

    android:layout_marginRight="30dp"  右边的距离

    android:layout_centerHorizontal="true/false"     设置是否相对父容器水平居中

    android:layout_centerVertical="true/false"       设置是否相对父容器垂直居中

    android:layout_centerInParent="true/false"    设置是否相对父容器中居中

    1.2相对控件布局

    android:layout_above="@id/已知控件id"    未知控件位于已知控件之上

    android:layout_marginBottom="30dp"      未知控件下边与已知控件的距离

    android:layout_below="@id/已知控件id"     位于已知控件之下

    android:layout_Top="30dp"    上边与已知控件的距离

    android:layout_toLeftOf="@id/已知控件id"      位于已知控件左边

    android:layout_marginRight="30dp"       右边与已知控件的距离

    android:layout_toRightOf="@id/已知控件id"    位于已知控件右边

    android:layout_marginLeft="30dp"    左边与已知控件的距离

    2.线性布局LinearLayout

    2.1水平线性布局

    android:layout_orientation="horizontal"      水平布局

    2.2垂直线性布局

    android:layout_orientation="vertical"       垂直水平

    附:android:layout_gravity="位置"        控件本身的对齐方式

    android:gravity="位置"       包含在里面的控件对齐方式

    3.表格布局TableLayout

    一行为一个TableRow(<TableRow 属性>控件1...控件n</TableRow>)里面的一个控件为一个单元格

    android:stretchColumns="列数"     指定该列被拉伸,列号从0开始

    android:shrinkColumns="列数"       指定该列被收缩,列号从0开始

    android:collapseColumns="列数"      指定该列被隐藏,列号从0开始

    4.网格布局GridLayout

    布局就是将界面分割成行、列、单元

    android:columnCount="数字"       分割成几列

    android:rowCount="数字"          分割成几行

    android:layout_column="数字"     控件所在第几列

    android:layout_row="数字"         控件所在第几行

    android:layout_rowSpan="数字"      控件跨越行数

    android:layout_gravity=" "        控件位置

    5.帧布局FrameLayout  重叠

    垂直滚动视图ScrollView

    <ScrollView  属性></ScrollView>

    水平滚动视图HorizontalScrollView

    <HorizontalScrollView 属性></HorizontalScrollView>

  • 相关阅读:
    不用写Windows服务实现定时器功能(FluentScheduler )
    (转).NET开发人员必备的可视化调试工具(你值的拥有)
    《C#本质论》读书笔记(14)支持标准查询操作符的集合接口
    关闭 Visual Studio 2013 的 Browser Link 功能
    《C#本质论》读书笔记(12)委托和Lambda表达式
    (2)Underscore.js常用方法
    JS中级
    .NET开发工具之Excel导出公共类
    (1)Underscore.js入门
    datatable绑定comboBox显示数据[C#]
  • 原文地址:https://www.cnblogs.com/ZSK991656110/p/4807111.html
Copyright © 2011-2022 走看看