首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >浮点StackLayout xamarin表单

浮点StackLayout xamarin表单
EN

Stack Overflow用户
提问于 2017-08-11 04:44:59
回答 1查看 1K关注 0票数 0

我想在我的内容有一个'StackLayout‘固定和浮动的地方,它将包含4个’按钮的。

我现在的布局是assikm

代码语言:javascript
复制
     <?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----- //

EN

回答 1

Stack Overflow用户

发布于 2017-08-11 09:34:33

通过将项目放在相同的行和列中,Grid可以将项目放在其他项目的顶部,如下所示。我要指出的是,根据您放置Button的方式,将Button放置在用户应该滚动的位置可能是一个可用性问题。

代码语言:javascript
复制
<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
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45623172

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档