SOUI官方论坛

 找回密码
 立即注册
查看: 179|回复: 3

线性布局问题

[复制链接]

该用户从未签到

2

主题

11

帖子

74

积分

24:00金丹期

Rank: 2

积分
74
发表于 2020-8-20 11:45:48 | 显示全部楼层 |阅读模式
  1. <SOUI name="mainWindow" maxinset="3,3,3,3" title="@string/title" bigIcon="ICON_LOGO:32" smallIcon="ICON_LOGO:16" margin="5,5,5,5"  resizable="1" wndType="appMain"
  2. appWnd="1"
  3. translucent="1"
  4. >
  5.   <root colorBkgnd="@color/common_bg"  cache="1"  width="600" height="400">
  6.     <caption pos="0,0,-0,100" show="1" font="adding:0" colorBkgnd="@color/main_title" >
  7.       <text pos="10,9" colorText="@color/white">@string/title</text>
  8.       <imgbtn name="btn_close" skin="_skin.sys.btn.close"    pos="-45,0" tip="close" animate="1"/>
  9.       <imgbtn name="btn_max" skin="_skin.sys.btn.maximize"  pos="-83,0" animate="1" />
  10.       <imgbtn name="btn_restore" skin="_skin.sys.btn.restore"  pos="-83,0" show="0" animate="1" />
  11.       <imgbtn name="btn_min" skin="_skin.sys.btn.minimize" pos="-121,0" animate="1" />
  12.     </caption>
  13.     <window layout="vbox" pos="5,[5,-5,-5" colorBkgnd="@color/white"  >
  14.       <window extend_top="5" size="-2,30" layout="hbox" >
  15.         <button name="button1" id="102" text="Button1" weight="1" size="0,-2" extend_left="5" drawFocusRect="0"></button>
  16.         <button name="button2"  text="Button2" weight="1" size="0,-2" extend_left="5" drawFocusRect="0"></button>
  17.         <button name="button3"  text="Button3" weight="1" size="0,-2" extend_left="5" drawFocusRect="0"></button>
  18.         <button name="button4"  text="Button4" weight="1" size="0,-2" extend_left="5" drawFocusRect="0"></button>
  19.         <button name="button5"  text="Button5" weight="1" size="0,-2" extend_left="5" extend_right="5" drawFocusRect="0"></button>
  20.       </window>
  21.       <window extend_top="5" size="-2,30" layout="hbox" >
  22.         <button text="Button1" weight="1" size="0,-2" extend_left="5" drawFocusRect="0"></button>
  23.         <button text="Button2" weight="1" size="0,-2" extend_left="5" drawFocusRect="0"></button>
  24.         <button text="Button3" weight="1" size="0,-2" extend_left="5" drawFocusRect="0"></button>
  25.         <button text="Button4" weight="1" size="0,-2" extend_left="5" drawFocusRect="0"></button>
  26.         <button text="Button5" weight="1" size="0,-2" extend_left="5" extend_right="5" drawFocusRect="0"></button>
  27.       </window>
  28.       <window extend_top="5" size="-2,30" layout="hbox" >
  29.         <button text="Button1" weight="1" size="0,-2" extend_left="5" drawFocusRect="0"></button>
  30.         <button text="Button2" weight="1" size="0,-2" extend_left="5" drawFocusRect="0"></button>
  31.         <button text="Button3" weight="1" size="0,-2" extend_left="5" drawFocusRect="0"></button>
  32.         <button text="Button4" weight="1" size="0,-2" extend_left="5" drawFocusRect="0"></button>
  33.         <button text="Button5" weight="1" size="0,-2" extend_left="5" extend_right="5"  drawFocusRect="0"></button>
  34.       </window>
  35.       <window extend_top="5" size="-2,30" layout="hbox" >
  36.         <button text="Button1" weight="1" size="0,-2" extend_left="5" drawFocusRect="0"></button>
  37.         <button text="Button2" weight="1" size="0,-2" extend_left="5" drawFocusRect="0"></button>
  38.         <button text="Button3" weight="1" size="0,-2" extend_left="5" drawFocusRect="0"></button>
  39.         <button text="Button4" weight="1" size="0,-2" extend_left="5" drawFocusRect="0"></button>
  40.         <button text="Button5" weight="1" size="0,-2" extend_left="5" extend_right="5"  drawFocusRect="0"></button>
  41.       </window>
  42.       <window size="-1,-2" layout="vbox" >
  43.         <button text="Button1" weight="1" size="-1,0" extend_left="5" drawFocusRect="0"></button>
  44.         <button text="Button2" weight="1" size="-1,0" extend_left="5" drawFocusRect="0"></button>
  45.         <button text="Button3" weight="1" size="-1,0" extend_left="5" drawFocusRect="0"></button>
  46.         <button text="Button4" weight="1" size="-1,0" extend_left="5" drawFocusRect="0"></button>
  47.         <button text="Button5" weight="1" size="-1,0" extend_left="5" drawFocusRect="0"></button>
  48.       </window>
  49.     </window>
  50.   </root>
  51. </SOUI>
复制代码


以上效果图是我在用线性布局是遇到的问题 首先是四个水平布局并且按钮是宽度是均分的,再一个垂直布局 我想按钮也是均分的但是 效果会超出整个大窗口,下面的垂直布局我只放一个按钮也是会超出布局,我哪里用错了

该用户从未签到

2

主题

11

帖子

74

积分

24:00金丹期

Rank: 2

积分
74
 楼主| 发表于 2020-8-20 11:49:28 | 显示全部楼层
效果图如下
111.png
  • TA的每日心情
    无聊
    5 天前
  • 签到天数: 13 天

    [LV.3]偶尔看看II

    42

    主题

    490

    帖子

    3352

    积分

    版主

    Rank: 7Rank: 7Rank: 7

    积分
    3352

    突出贡献优秀版主

    发表于 2020-8-20 14:34:55 | 显示全部楼层
    <window size="-1,-2" layout="vbox" >
    改成<window size="-1,0" weight="1" layout="vbox">

    该用户从未签到

    2

    主题

    11

    帖子

    74

    积分

    24:00金丹期

    Rank: 2

    积分
    74
     楼主| 发表于 2020-8-20 15:04:13 | 显示全部楼层

    感谢 感谢 Android开发做多了绕进去了 你这么一说我也理解原因了,包裹内容跟全屏整懵了
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    QQ|Archiver|手机版|小黑屋|SOUI官方论坛 ( 粤ICP备18103663号-2 )

    GMT+8, 2020-12-6 02:19

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表