TA的每日心情 | 奋斗 2021-6-22 19:08 |
---|
签到天数: 1 天 [LV.1]初来乍到
24:00金丹期
- 积分
- 63
|
======================== 布局xml
<SOUI name="window" title="布局" width="-2" height="48" wndType="appMain" toolWindow="0" translucent="0" round="10">
<root cache="1">
<caption name="caption" pos="0,0,200,-0" show="1" skin="QuickbarWndSK_bg" visible="1" >
<!-- 1 "Translator" -->
<imgbtn pos="8,10" size="32,32" skin="STWndSK_Btn" name="btn_Translator">
<img skin="STWndSK_Stop" pos="|0,|0" offset="-0.5,-0.5"></img>
</imgbtn>
<!-- 2 CreateNormalNote -->
<hr pos="[10, |0" offset="0, -0.5" size="0, 26" lineSize="1" lineColor="#FFFFFF" lineStyle="solid" mode="vertical"/>
<imgbtn pos="[8,10" size="32,32" skin="STWndSK_Btn" name="btn_Translator">
<img skin="STWndSK_Stop" pos="|0,|0" offset="-0.5,-0.5"></img>
</imgbtn>
<!-- 3 CreateTodoList -->
<imgbtn pos="[8,10" size="32,32" skin="STWndSK_Btn" name="btn_Translator">
<img skin="STWndSK_Stop" pos="|0,|0" offset="-0.5,-0.5"></img>
</imgbtn>
</caption>
<window layout="hbox" size="-1,-1" colorBkgnd="#cccccc" gravity="center" name="LKLK">
<!--线性布局的自适应子窗口大小-->
<text visible="0" display="0">vbox + gravity + wrapContent</text>
<window size="100,30" colorBkgnd="#ff0000" name="xxx"/>
<window size="200,30" extend="10,5,10,5" colorBkgnd="#ff0000"/>
<window size="120,30" layout_gravity="right" colorBkgnd="#ff0000"/>
</window>
</root>
============ 控制代码
SWindow *tpSW = (SWindow*)FindChildByName(L"LKLK");
//tpSW->GetChildrenCount();
SetWndAttribute(L"xxx", L"display", L"0");
SetWndAttribute(L"xxx", L"visible", L"0");
===== SetWndAttribute 窗口类成员函数
void SetWndAttribute(LPCWSTR wndName, LPCWSTR attribName, LPCWSTR attribValue)
{
SWindow *tpSW = FindChildByName(wndName);
if (tpSW)
{
tpSW->SetAttribute(attribName, attribValue);
}
}
如上所示:
1、主窗口是的宽度设置的自动调整
2、通过代码隐藏了hbox中的子窗口,此时hbox自动调整了大小。
3、问题来了,主窗口的大小为啥没有自动调整,要想实现自动大小调整,需要怎么干。
有请大神指导指导~~
|
|