• unity GUI Layout 组件(全)


    【expand 扩张】【fitter 装配工】 【envelope 信封,包装】

    Layout 布局 三种。  

    Horizontal Layout Group

    水平布局

    Padding:内边距,单位像素。

    Spacing:子物体间的间隔,单位像素。

    Child Alignment:对齐方式。

    Controls Child Size:布局组件是否控制子物体的 width / height

    Child Force Expand:是否自适应宽高

     Vertical Layout Group

    垂直布局

    同上。 

    Grid Layout Group

     网格布局

    Padding:略

    Cell Size(X,Y):子物体大小

    Spacing(X,Y):子物体xy轴上的间隔像素

    Start Corner:第一个子物体所在的角落(Upper Left、等四个角)

    Start Axis:子物体排列方向(Horizontal、Vertical)

    Child Alignment:对齐方式(左上,上中,左下等九个方向)

    Constraint:固定每行个数或每列个数或无。

       

     子物体更多设置组件
    Layout Element

    使用了三种 Group 布局组件之后,就无法控制 RectTransform 的宽高了。

    LayoutElement组件 是为了单独设置该物体。

    步骤:

      1)勾选 父物体的Group组件的 Control Child Size,(不要勾选 Child Force Expand。不然设置的首选参数Preferred Width / Preferred Height 不会起作用。)

      2)设置属性:

        a. Min Width / Height 最小宽高。

        b. Preferred Width / Height 首选宽高

        c. Flexible Width / Height ;layout 组件会把所有子物体按照 Flexible Height 的比例分配高度,如三个 Flexible Height为1,则每个子物体的高度都是 1/3 。

    Aspect Ratio Fitter

     Aspect Mode: 

      1) None;

      2)Width Controls Height; 由宽度根据宽高比来设置 height

      3) Height Controls Width; 由height 根据宽高比设置 width

      4) Fit In Parent;锁定宽高比,宽度填满父物体。

      5)Envelope Parent;锁定宽高比,高度填满父物体。

    Content Size Fitters

    需要和 Layout Element 组合使用。

     Horizontal Fit:

      1)MinSize,父物体的width 适应子物体的Layout Element 的最大 Min Width。

    Vertical Fit:

      1)略

  • 相关阅读:
    c#读取文件内容存放到int数组 array.txt
    YxShop_V4.2.0开源免费商城2009新春版发布,整合dz最新版,开源!
    c# 读取xml文件 "分析 EntityName 时出错"的解决方案
    正则表达式口诀
    c#操作xml文件
    在WebClient类中保持Session
    实测SCSI RAID速度
    朋友送我的一套书
    给LFF占了个板凳
    ECC内存也能坏
  • 原文地址:https://www.cnblogs.com/sweetXiaoma/p/9358814.html
Copyright © 2020-2023  润新知