gpt4 book ai didi

c# - Xamarin 表格 : Image height request ignored inside frame inside relative layout

转载 作者:太空狗 更新时间:2023-10-29 18:11:52 24 4
gpt4 key购买 nike

我有以下代码:

<ScrollView Orientation="Vertical" Padding="0" VerticalOptions="FillAndExpand">
<StackLayout Spacing="0" Padding="15,0">
<Frame HasShadow="false" BackgroundColor="Transparent" Padding="0">
<RelativeLayout BackgroundColor="Olive" Padding="0" VerticalOptions="End">
<Frame HeightRequest="100" WidthRequest="100" BackgroundColor="Purple" Padding="0" HasShadow="false">
<Image HeightRequest="50" WidthRequest="50" Source="assets/avatar-man.png"></Image>
</Frame>
<BoxView HeightRequest="100" BackgroundColor="Teal" RelativeLayout.XConstraint="{ConstraintExpression Type=Constant, Constant=100}" RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1, Constant=-100}" />
<Frame BackgroundColor="Transparent" HasShadow="false" Padding="0" RelativeLayout.XConstraint="{ConstraintExpression Type=Constant, Constant=100}" RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1, Constant=-100}">
<Label>Hello</Label>
</Frame>
</RelativeLayout>
</Frame>
</StackLayout>
</ScrollView>

但是,由于某种原因,图像高度请求被忽略,它没有显示 50x50 单位正方形,而是像这样填满整个屏幕:

Issue Image

有谁知道为什么这会被忽略以及如何解决这个问题?

最佳答案

我遇到了同样的问题,我最终像这样在我的图像周围包装了一个 StackLayout:

<StackLayout>
<Image Source="{Binding MyImage}" WidthRequest="50" HeightRequest="50"/>
</StackLayout>

关于c# - Xamarin 表格 : Image height request ignored inside frame inside relative layout,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30427009/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com