Xamarin.Forms按钮的ContentLayout属性无法正常工作

时间:2018-10-30 22:12:34

标签: ios xaml xamarin.forms

我在StackLayout中添加了4个按钮,并使用ContentLayout属性设置图像和按钮文本之间的间距。当图像放置在文本旁边时,间距将按预期工作。但是,当我将图像放置在文本下方时,间距不起作用。

<?xml version="1.0" encoding="utf-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:Buttons" x:Class="Buttons.MainPage">
    <StackLayout Padding="50">
        <Button ContentLayout="Right,50" Text="Sometext" Image="euro.png" HeightRequest="125" BackgroundColor="Teal" WidthRequest="250" HorizontalOptions="Center" TextColor="White"/>
        <Button ContentLayout="Left,50" Text="Sometext" Image="euro.png" HeightRequest="125" BackgroundColor="Teal" WidthRequest="250" HorizontalOptions="Center" TextColor="White"/>
        <Button ContentLayout="Top,50" Text="Sometext" Image="euro.png" HeightRequest="125" BackgroundColor="Teal" WidthRequest="250" HorizontalOptions="Center" TextColor="White"/>
        <Button ContentLayout="Bottom,50" Text="Sometext" Image="euro.png" HeightRequest="125" BackgroundColor="Teal" WidthRequest="250" HorizontalOptions="Center" TextColor="White"/>
    </StackLayout>
</ContentPage>

随附了说明问题的屏幕截图。有人知道如果我做错了什么吗?

Screenshot 4 buttons

0 个答案:

没有答案