Xamarin Forms如何水平填充图像视图并垂直扩展?

时间:2019-07-12 18:21:43

标签: image xamarin layout xamarin.forms cross-platform

我无法固定 ImageButton 的宽度,并且 Height 会随着我在 ImageButton < / strong>,我在 Scrollview 中多次使用 ImageButton ,我使用 Visual Studio 创建了一个跨平台应用程序< / strong>使用 Xamarin ,所以我用来解决问题的方法是herehere,但是我什么也解决不了,这是描述我想要的图片: enter image description here

如果我的问题有答案,请不要重复,因为我是 Xamarin Forms 的新手,而且我没有找到确切的答案,这是我的代码:-

<Frame CornerRadius="10"  OutlineColor="#fce9cc" Padding="4" Margin="15" VerticalOptions="StartAndExpand" 
       HasShadow="True" x:Name="ViewLayout" x:FieldModifier="public" BackgroundColor="Black">
        <StackLayout>
            <Label x:Name="filmNameLabel_1"  HorizontalOptions="Center" FontSize="Large" TextColor="White"
                   Margin="0,15,0,15"/>

            <StackLayout Orientation="Vertical">
                <ImageButton x:Name="imageWidget_1" BackgroundColor="Black" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" Aspect="AspectFill"/>
            </StackLayout>

        </StackLayout>
    </Frame>

我第一次将 StackLayout ImageButton 的HeightRequest的父级设置为一个数字,这将使 ImageButton 高度是一个固定的数字,但我不希望 ImageButton 高度 随图像的大小而变化比率再见固定在旁边的宽度 父级布局。

0 个答案:

没有答案