Xaml 浮动堆栈布局xamarin表单

Xaml 浮动堆栈布局xamarin表单,xaml,xamarin,xamarin.forms,Xaml,Xamarin,Xamarin.forms,我希望在我的内容中有一个固定和浮动的“StackLayout”,其中包含4个按钮 我的布局目前还不完善 <?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" Title

我希望在我的内容中有一个固定和浮动的“StackLayout”,其中包含4个按钮

我的布局目前还不完善

     <?xml version="1.0" encoding="utf-8" ?>
       <ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
         Title="teste">


   <Grid>
        <ScrollView BackgroundColor="#ffffff" Padding="15" Grid.Row="0">
        <StackLayout HorizontalOptions="Fill" VerticalOptions="FillAndExpand">
            <Label Text="{Binding Titulo}"  VerticalTextAlignment="Center" HorizontalTextAlignment="Center" TextColor="#38B6AB" FontSize="22" FontAttributes="Bold"/>
            <Label Text="{Binding Data}"  VerticalTextAlignment="Center" HorizontalTextAlignment="Center" TextColor="#5a5a5a" FontSize="18"  FontAttributes="Bold"/>

            <Image x:Name="imagen1" Source="{Binding ImageSource}" Aspect="AspectFit">
                <Image.GestureRecognizers>
                    <TapGestureRecognizer
                    Tapped="OnTapped" />
                </Image.GestureRecognizers>
            </Image>

        </StackLayout>
    </ScrollView>
</Grid>
//-----Floating button----- //

//-----浮动按钮------//

网格可以通过将项目放置在同一行和同一列中,将项目浮动到其他项目之上,如下所示。我会注意到,根据您放置
按钮的方式,将
按钮放置在假定用户滚动的位置可能是一个可用性问题

<Grid>

  <Grid.RowDefinitions>
    <RowDefinition Height="Auto" />
  </Grid.RowDefinitions>

  <Grid.ColumnDefinitions> <!-- Multiple columns will allow even Button spacing, just set Grid.ColumnSpan on your ScrollView -->
    <ColumnDefinition Width="*" />
    <ColumnDefinition Width="*" />
    <ColumnDefinition Width="*" />
    <ColumnDefinition Width="*" />
  </Grid.ColumnDefinitions>

  <ScrollView BackgroundColor="#ffffff"
              Padding="15"
              Grid.Row="0"
              Grid.Column="0"
              Grid.ColumnSpan="4">
    <StackLayout HorizontalOptions="Fill"
                 VerticalOptions="FillAndExpand">
            ....                
    </StackLayout>
  </ScrollView>

  <Button Text="One"
          Grid.Row="0"
          Grid.Column="0"/>

  <Button Text="Two"
          Grid.Row="0"
          Grid.Column="1"/>

  <Button Text="Three"
          Grid.Row="0"
          Grid.Column="2"/>

  <Button Text="Four"
          Grid.Row="0"
          Grid.Column="3"/>
</Grid>

....                

网格
可以通过将项目放置在同一行和同一列中,将项目浮动到其他项目之上,如下所示。我会注意到,根据您放置
按钮的方式,将
按钮放置在假定用户滚动的位置可能是一个可用性问题

<Grid>

  <Grid.RowDefinitions>
    <RowDefinition Height="Auto" />
  </Grid.RowDefinitions>

  <Grid.ColumnDefinitions> <!-- Multiple columns will allow even Button spacing, just set Grid.ColumnSpan on your ScrollView -->
    <ColumnDefinition Width="*" />
    <ColumnDefinition Width="*" />
    <ColumnDefinition Width="*" />
    <ColumnDefinition Width="*" />
  </Grid.ColumnDefinitions>

  <ScrollView BackgroundColor="#ffffff"
              Padding="15"
              Grid.Row="0"
              Grid.Column="0"
              Grid.ColumnSpan="4">
    <StackLayout HorizontalOptions="Fill"
                 VerticalOptions="FillAndExpand">
            ....                
    </StackLayout>
  </ScrollView>

  <Button Text="One"
          Grid.Row="0"
          Grid.Column="0"/>

  <Button Text="Two"
          Grid.Row="0"
          Grid.Column="1"/>

  <Button Text="Three"
          Grid.Row="0"
          Grid.Column="2"/>

  <Button Text="Four"
          Grid.Row="0"
          Grid.Column="3"/>
</Grid>

....                

2个错误,按钮包含所有内容,无法移动scrowview,其他错误和按钮位于中间,更正并显示在footer@José您没有指定要在哪里使用
按钮。这只是向您展示如何做的一个起点。随意调整它,直到你有你想要的。这不是一个简单的解决方案,而是帮助你学会如何去做。如果你无法按照你想要的方式定位它们,请告诉我或发布一个新问题,好的,我定位有困难是的,我将打开另一个ask2错误,按钮占据所有内容,无法移动scrowview,其他错误和按钮位于中间,更正并显示在footer@José您没有指定要在哪里使用
按钮。这只是向您展示如何做的一个起点。随意调整它,直到你有你想要的。这不是一个简单的解决方案,而是帮助你学会如何去做。如果你无法按照你想要的方式定位它们,请告诉我或发布一个新问题,好的,我定位有困难是的,我将打开另一个问题