一半以上xamarin其它图像的图像形成
我与xamarin形式 工作,我需要创建两个对象的布局positionated这样的:一半以上xamarin其它图像的图像形成
半一个(圆)以上另一个对象(方形)
我已经搜索,它似乎我需要使用相对布局... 我试图做到这两个对象设置在同一个网格(行和第0行),然后,使用constraintX在同一个Y中用因子0和负常数设置第二个......但它没有工作。不幸的是,删除了这些行,并且无法在这里显示......唯一发生在此处的是:两者在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>
但是,当我使用高度和宽度请求时,静态大小,以我的看法,不是吗? –
是的,我用它来实现你的视觉模型。您必须将BoxView和Frame元素更改为图像。关于固定大小,并使用像Horizontal和VerticalOptions,Grid.Column,Row和RowSpan这样的位置属性。告诉我它是否可以像你想要的那样工作 –
不是100%确定这里要问的是,但如果你需要在一个正方形上画一个圆,这是一个自定义控件的好选择,你直接画到本地画布 – snowCrabs