【发布时间】:2015-12-02 23:03:40
【问题描述】:
我想做一个像砌体布局一样的布局,如果屏幕宽度不够,哪个项目会自动排列到下一行。但不使用网格布局。这两种布局都不起作用。
使用堆栈布局:
<StackLayout orientation="horizontal" style="vertical-align:top;">
<Button text="one" style="height:50;"/>
<Button text="two" style="height:50;"/>
<Button text="three" style="height:50;"/>
<Button text="four" style="height:50;"/>
<Button text="five" style="height:50;"/>
<Button text="five" style="height:50;"/>
<Button text="five" style="height:50;"/>
<Button text="five" style="height:50;"/>
</StackLayout>
使用网格布局
<GridLayout rows="174,174,auto" columns="147,147" horizontalAlignment="center" verticalAlignment="center">
<Image col="0" row="0" cssClass="imglogo" src="~/images/icondapur.png" stretch="aspectFit" horizontalAlignment="center"/>
<Image col="0" row="1" cssClass="imglogo" src="~/images/iconrokok.png" stretch="aspectFit" horizontalAlignment="center"/>
<Image col="1" row="0" cssClass="imglogo" src="~/images/iconsabun.png" stretch="aspectFit" horizontalAlignment="center"/>
<Image col="1" row="1" cssClass="imglogo" src="~/images/iconsnack.png" stretch="aspectFit" horizontalAlignment="center"/>
</GridLayout>
【问题讨论】:
标签: javascript android nativescript