我如何能够以xamarin形式对工具栏进行50%的控制?

时间:2017-11-15 10:13:22

标签: xamarin.forms

我如何将50%的控制权放在菜单栏上50%的图像视图中,并将50%的控制权放在页面上,就像屏幕截图一样?please find attached screenshot...as showing in image there is circular image ,half section of image placed over the toolbar and rest placed over the page

我尝试使用相对布局实现此目的但无法做到这一点.. 请有人知道帮我设计这样的UI。

        <Button  HeightRequest="50" WidthRequest="50" BorderRadius="35" BackgroundColor="Aqua"
            RelativeLayout.XConstraint= "{ConstraintExpression Type=RelativeToParent, Property=Width, Factor = .5}"
            RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor = -.05}" />

1 个答案:

答案 0 :(得分:0)

您可以使用绝对布局

来完成此操作
          <AbsoluteLayout BackgroundColor="white">
                <BoxView BackgroundColor="Aqua" AbsoluteLayout.LayoutBounds="0
                    0,1,100" AbsoluteLayout.LayoutFlags="XProportional,YProportional,WidthProportional" />
                <Button BackgroundColor="White"
                    AbsoluteLayout.LayoutBounds=".5,75,70,70" AbsoluteLayout.LayoutFlags="XProportional" BorderRadius="35" />
                <Button BackgroundColor="Red" AbsoluteLayout.LayoutBounds=".5
                    80,60,60" AbsoluteLayout.LayoutFlags="XProportional" BorderRadius="30" />
            </AbsoluteLayout>

Reference