Xamarin.forms 想要在内容页底部的按钮

Xamarin.forms 想要在内容页底部的按钮,xamarin.forms,Xamarin.forms,我在上圈做一个应用程序设计,我在主页上使用以下内容,这是一个登录/创建计数 我正在使用一个应用程序外壳,下面是我的内容页,但是我需要按钮显示在图像的底部,但是目前它显示在顶部 <AbsoluteLayout HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"> <Image Source="TeslaBackground.png" AbsoluteLayout.LayoutBounds="0

我在上圈做一个应用程序设计,我在主页上使用以下内容,这是一个登录/创建计数

我正在使用一个应用程序外壳,下面是我的内容页,但是我需要按钮显示在图像的底部,但是目前它显示在顶部

<AbsoluteLayout HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
    <Image Source="TeslaBackground.png" AbsoluteLayout.LayoutBounds="0,0,1,1" AbsoluteLayout.LayoutFlags="All" Aspect="AspectFill"/>
    <StackLayout Orientation="Horizontal" VerticalOptions="End">
       <telerikInput:RadButton x:Name="btnSignIn"   Text="Sign in" />
      <telerikInput:RadButton x:Name="btnCreateAccount" Text="Create Account" />
 </StackLayout>
</AbsoluteLayout>


它们应该显示在选项卡栏的正上方

您可以使用stacklayout执行此操作,例如:

<StackLayout HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand">
  <StackLayout Orientation="Horizontal" VerticalOptions="EndAndExpand" 
   HorizontalOptions="StartAndExpand">
         <telerikInput:RadButton x:Name="btnSignIn"   Text="Sign in" />
         <telerikInput:RadButton x:Name="btnCreateAccount" Text="Create Account" />
  </StackLayout>
</StackLayout>

您可以使用stacklayout执行此操作,例如:

<StackLayout HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand">
  <StackLayout Orientation="Horizontal" VerticalOptions="EndAndExpand" 
   HorizontalOptions="StartAndExpand">
         <telerikInput:RadButton x:Name="btnSignIn"   Text="Sign in" />
         <telerikInput:RadButton x:Name="btnCreateAccount" Text="Create Account" />
  </StackLayout>
</StackLayout>

我需要按钮出现在底部的图像,但目前它出现在顶部

从共享代码中,仅将
AbsoluteLayout.layoutbunds
设置为图像。还需要将
AbsoluteLayout.layoutbunds
设置为根
AbsoluteLayout
内的
StackLayout

<AbsoluteLayout HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
    <Image Source="TeslaBackground.png" AbsoluteLayout.LayoutBounds="0,0,1,1" AbsoluteLayout.LayoutFlags="All" Aspect="AspectFill"/>
    <StackLayout Orientation="Horizontal" AbsoluteLayout.LayoutFlags="All"
                     AbsoluteLayout.LayoutBounds=".5,1,.5,.1">
       <telerikInput:RadButton x:Name="btnSignIn"   Text="Sign in" />
      <telerikInput:RadButton x:Name="btnCreateAccount" Text="Create Account" />
 </StackLayout>
</AbsoluteLayout>
您可以参考有关的官方文档来更改每个值以满足您的需要

绝对布局中的视图使用四个值进行定位:

  • X–视图锚定的X(水平)位置
  • Y–视图定位点的Y(垂直)位置
  • 宽度–视图的宽度
  • 高度–视图的高度
这些值中的每一个都可以设置为比例值或绝对值

值指定为边界和标志的组合<代码>布局边界
由四个值组成:
x
y
宽度
高度

我需要按钮出现在底部的图像,但目前它出现在顶部

从共享代码中,仅将
AbsoluteLayout.layoutbunds
设置为图像。还需要将
AbsoluteLayout.layoutbunds
设置为根
AbsoluteLayout
内的
StackLayout

<AbsoluteLayout HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
    <Image Source="TeslaBackground.png" AbsoluteLayout.LayoutBounds="0,0,1,1" AbsoluteLayout.LayoutFlags="All" Aspect="AspectFill"/>
    <StackLayout Orientation="Horizontal" AbsoluteLayout.LayoutFlags="All"
                     AbsoluteLayout.LayoutBounds=".5,1,.5,.1">
       <telerikInput:RadButton x:Name="btnSignIn"   Text="Sign in" />
      <telerikInput:RadButton x:Name="btnCreateAccount" Text="Create Account" />
 </StackLayout>
</AbsoluteLayout>
您可以参考有关的官方文档来更改每个值以满足您的需要

绝对布局中的视图使用四个值进行定位:

  • X–视图锚定的X(水平)位置
  • Y–视图定位点的Y(垂直)位置
  • 宽度–视图的宽度
  • 高度–视图的高度
这些值中的每一个都可以设置为比例值或绝对值


值指定为边界和标志的组合
LayoutBounds
由四个值组成:
x
y
width
height

如果使用绝对布局,则需要指定控件的放置位置,否则它们默认位于左上角。如果使用的是AbsoluteLayout,则需要指定控件的放置位置,否则它们默认位于左上角。