我试图在StackLayout的底部放置一个按钮,但它不起作用。我不知道我做错了什么!

这是我的模板:
<Page actionBarHidden="true">
<GridLayout rows="*, *, *, *" columns="*">
<StackLayout horizontalAlignment="center"
verticalAlignment="center">
<Label text="My Account" id="login-label"/>
</StackLayout>
<CardView row="1" class="cardStyle" margin="10"
elevation="40"
radius="4"
verticalAlignment="center"
horizontalAlignment="center"
rowSpan="2"
id="login-box">
<StackLayout id="form-container">
<TextField hint="Login"/>
<TextField hint="Password"/>
<Label text="Forgot password?" horizontalAlignment="right"/>
<Button text="Button" @tap="loginButton()" verticalAlignment="bottom"/>
</StackLayout>
</CardView>
</GridLayout>
</Page>谢谢!
发布于 2018-11-13 11:50:03
StackLayout不支持它的设计。它习惯于在给定的方向上一个接一个地堆叠子元素,不能有混合输出--顶部的子元素很少,底部或中心的子元素很少。
使用Grid / Dock布局,以便在底部停靠一个元素。
https://stackoverflow.com/questions/53278228
复制相似问题