首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >VerticalTextAlignment="End“不会在<StackLayout>底部对齐我的文本

VerticalTextAlignment="End“不会在<StackLayout>底部对齐我的文本
EN

Stack Overflow用户
提问于 2018-07-22 21:57:38
回答 1查看 574关注 0票数 1

我有这样的代码:

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8"?>
<StackLayout xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
             xmlns:local="clr-namespace:Japanese;assembly=Japanese" 
             x:Class="Japanese.Templates.HeaderTemplate" 
             x:Name="this" BackgroundColor="#efeff4" HorizontalOptions="FillAndExpand" Orientation="Vertical" Spacing="0" Margin="0">
    <StackLayout HeightRequest="50" >
        <Label Text="ABC" HorizontalOptions="Start" VerticalTextAlignment="End" Margin="20, 0, 0, 0" />
    </StackLayout>
</StackLayout>

当它运行时,文本ABC出现在单元格的顶部,而不是底部。

有人能给我解释一下为什么我用VerticalTextAlighment="End“的时候它不出现在底部吗?

我也尝试过这样做,但它仍然将文本放在StackLayout的顶部:

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8"?>
<StackLayout xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
             xmlns:local="clr-namespace:Japanese;assembly=Japanese" 
             x:Class="Japanese.Templates.HeaderTemplate" 
             x:Name="this" BackgroundColor="#efeff4" HorizontalOptions="FillAndExpand" Orientation="Vertical" Spacing="0" Margin="0">
    <StackLayout HeightRequest="50" >
        <Label Text="ABC" HorizontalOptions="Start" VerticalTextAlignment="End" 
        VerticalOptions="End" Margin="20, 0, 0, 0" />
    </StackLayout>
</StackLayout>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-07-23 02:06:58

代码语言:javascript
复制
<ContentPage BackgroundColor="Purple" xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:test3" x:Class="test3.MainPage">
    <StackLayout BackgroundColor="Yellow">
        <!-- Place new controls here -->
        <Label BackgroundColor="Pink" Text="I'm at the bottom!" HorizontalOptions="Center" VerticalOptions="EndAndExpand" />
    </StackLayout>
</ContentPage>

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

https://stackoverflow.com/questions/51465812

复制
相关文章

相似问题

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