首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >StackLayout垂直对准

StackLayout垂直对准
EN

Stack Overflow用户
提问于 2018-11-13 09:52:16
回答 1查看 4.5K关注 0票数 1

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

这是我的模板:

代码语言:javascript
复制
<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>

谢谢!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-11-13 11:50:03

StackLayout不支持它的设计。它习惯于在给定的方向上一个接一个地堆叠子元素,不能有混合输出--顶部的子元素很少,底部或中心的子元素很少。

使用Grid / Dock布局,以便在底部停靠一个元素。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53278228

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档