简体   繁体   中英

Structure of my scrollview xamarin ios

I have the following structure and I want to put a scrollView in my ios application, when I place the Scrowview in this structure my data all disappear. How to make a correct structure where my scrollview works?

         <?xml version="1.0" encoding="utf-8" ?>
         <ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
         xmlns:controls="clr-namespace:g.Portable.Helpers;assembly=g.Portable"
         x:Class="g.Portable.Views.AboutPage"
         xmlns:cv="clr-namespace:Xamarin.Forms;assembly=Xamarin.Forms.CarouselView"
         Title="titulo">

<AbsoluteLayout  VerticalOptions="FillAndExpand">
<ScrollView HeightRequest="1000">

    <cv:CarouselView x:Name="MAinCarousel" VerticalOptions="Start" HeightRequest="250">
            <cv:CarouselView.ItemTemplate>
                <DataTemplate>
                    <Grid>
              <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
                <RowDefinition Height="Auto"/>
              </Grid.RowDefinitions>
              <Image x:Name="Image" Grid.RowSpan="2" Source="{Binding img}" Scale="1.0" Aspect="AspectFill" VerticalOptions="FillAndExpand" HeightRequest="250"/>
              <StackLayout Grid.Row="1" BackgroundColor="#80000000" Padding="5">
                  <Label TextColor="White" Text="{Binding category}" BackgroundColor="{Binding category_color}" Font="Bold" FontSize="16" HorizontalOptions="Start" VerticalOptions="CenterAndExpand"/>
                  <Label TextColor="White" Text="{Binding data}" FontSize="16" HorizontalOptions="Start" VerticalOptions="CenterAndExpand"/>
                  <Label TextColor="White" Text="{Binding titulo}" FontSize="18" HorizontalOptions="Start" Font="Bold" VerticalOptions="CenterAndExpand"/>
                  <Button Text="Clique aqui..." IsVisible="true" HeightRequest="16" Clicked="Handle_Clicked" TextColor="White" BackgroundColor="#1C86EE"/>
              </StackLayout>
            </Grid> 
                </DataTemplate>
            </cv:CarouselView.ItemTemplate>
    </cv:CarouselView>

        <StackLayout BackgroundColor="#234084">
        <Label Text="  Últimas " TextColor="White" Font="Bold" FontSize="16" BackgroundColor="#234084"/>
        </StackLayout>

        <ListView x:Name="listView"
           CachingStrategy="RecycleElement"
          ItemsSource="{Binding FeedItems}"
          HasUnevenRows="True"
        AbsoluteLayout.LayoutFlags="All"
        AbsoluteLayout.LayoutBounds="0,0,1,1" HeightRequest="344" VerticalOptions="Fill">
            <ListView.ItemTemplate>
                <DataTemplate>
                    <ViewCell>
                        <Grid Padding="5">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="70"/>
                                <ColumnDefinition Width="5"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <StackLayout HeightRequest = "60" WidthRequest="60">
                                <Image x:Name="Image"  Source="{Binding Image}" Scale="1.0" Aspect="AspectFill" VerticalOptions="FillAndExpand"/>
                         </StackLayout>
                            <StackLayout Grid.Column="2" Spacing="4"  VerticalOptions="Center">
                               <Label Text="{Binding Category}" TextColor="White"  FontSize="Small" LineBreakMode="NoWrap" BackgroundColor="{Binding Color_category}"/>
                                <Label Text="{Binding PublishDate}" TextColor="#666666" FontSize="Small" LineBreakMode="NoWrap"/>
                                <Label Text="{Binding Title}" TextColor="#234084" Font="Bold" FontSize="Small" LineBreakMode="WordWrap"/>
                            </StackLayout>
                        </Grid>
                    </ViewCell>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>
      </ScrollView>
 <StackLayout IsVisible="{Binding IsBusy}" BackgroundColor="#80000000" Padding="12"
                                AbsoluteLayout.LayoutFlags="PositionProportional"
                                AbsoluteLayout.LayoutBounds="0.5,0.5,-1,-1">
      <ActivityIndicator IsRunning="{Binding IsBusy}" Color ="White">
      </ActivityIndicator>
      <Label Text="Carregando..." HorizontalOptions="Center" TextColor="White"/>

    </StackLayout>

</AbsoluteLayout>

You have multiple children in ScrollView. That is not going to work. ScrollView can have only one direct child

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM