gpt4 book ai didi

xaml - xamarin 形式的图像上方的一半图像

转载 作者:行者123 更新时间:2023-12-04 02:18:24 25 4
gpt4 key购买 nike

我正在使用 xamarin 表单
我需要创建一个布局,其中包含两个这样定位的对象:

enter image description here

一个(圆)的一半在另一个对象(正方形)上方

我已经搜索过,似乎我需要使用相对布局...
我尝试将两个对象设置在同一个网格(行和行 0)中,然后使用约束 X 在同一个 Y 中设置第二个对象,因子为 0 和一个负常数......但它没有用。 a 删除了行并且无法在这里显示,不幸的是……唯一发生的事情是:两者在 y 中的位置相同,但我可以像上图那样做……
有人可以帮我举个例子,想法或任何东西吗?非常感谢!

我现在的代码 - rodape 图像是正方形,重新加载是圆形
我现在重新加载在方块下的事实是错误的,但是,现在,它是假装视觉......它给了我一个我想要的结果......但不完全是

<!--Rodapé Grid-->
<RelativeLayout HorizontalOptions="FillAndExpand"
VerticalOptions="EndAndExpand"
BackgroundColor="Black">
<Grid BackgroundColor="Red"
RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent,
Property=Width,
Factor=1,
Constant=0}">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>

<Image Source="rodape.png"
Aspect="Fill"
HorizontalOptions="FillAndExpand"
Grid.Row="0"
Grid.Column="0">
<Image.GestureRecognizers>
<TapGestureRecognizer Tapped="FranqueadoOnTapGestureRecognizerTapped"/>
</Image.GestureRecognizers>
</Image>
<!--Escrito Rodapé-->
<StackLayout Orientation="Vertical"
VerticalOptions="End"
HorizontalOptions="FillAndExpand"
Grid.Row="0"
Spacing="0"
Grid.Column="0">
<Image Source="reloadicon.png"/>
<StackLayout Orientation="Horizontal"
HorizontalOptions="Center">
<local:MyLabel NamedFontSize="Medium"
FontSizeFactor="0.7"
Text="Seja um Franqueado:"
TextColor="White"
FontAttributes="Bold"
Style="{StaticResource labelsfont}"/>
<local:MyLabel NamedFontSize="Medium"
FontSizeFactor="0.7" Text="montanaexpress.com"
Style="{StaticResource labelsfont}"
TextColor="{StaticResource laranjacolor}"/>
</StackLayout>
</StackLayout>
</Grid>
</RelativeLayout>

最佳答案

尝试这样的事情,我认为它更简单:

<Grid>
<BoxView Grid.Column="0" Grid.Row="1"
Color="Red"
HeightRequest="20"
HorizontalOptions="FillAndExpand"/>
<Frame Grid.Column="0" Grid.Row="0" Grid.RowSpan="2"
BackgroundColor="Yellow"
HorizontalOptions="CenterAndExpand"
VerticalOptions="CenterAndExpand"
WidthRequest="40"
HeightRequest="40"
CornerRadius="40"
Margin="0,5,0,10"/>
</Grid>

你会得到什么:
enter image description here

编辑:

正如您在评论中所要求的那样,使用您的图片您应该执行以下操作:
<Grid>   
<Image Grid.Row="1" Grid.Column="0"
Source="rodape.png"
Aspect="Fill"
HorizontalOptions="FillAndExpand">
<Image.GestureRecognizers>
<TapGestureRecognizer Tapped="FranqueadoOnTapGestureRecognizerTapped"/>
</Image.GestureRecognizers>
</Image>
<Image Grid.Column="0" Grid.Row="0" Grid.RowSpan="2"
Source="reloadicon.png"
HorizontalOptions="CenterAndExpand"
VerticalOptions="Center"/>
</Grid>

注意:我无法弄清楚标签和图像应如何在您的布局中显示。你必须手动添加

关于xaml - xamarin 形式的图像上方的一半图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45940623/

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