【发布时间】:2019-10-28 17:33:32
【问题描述】:
我在一个页面中有两个 ListView,我希望它们以这样一种方式显示,即只要我将第一个向下滚动到按钮,第二个就会跟随。我该怎么做?
到目前为止,我能够显示两个 ListView,但它们将屏幕分成两部分,第一个列表视图在顶部,第二个在按钮上(见下面的截图!)
我想要实现的就像下面链接中的图片:
https://cdn.dribbble.com/users/2568324/screenshots/6893977/dribbble8.png
我的代码如下:
<Frame>
<ListView x:Name = "MainMagazine" RowHeight="200" ItemSelected="MainMagazine_se" VerticalOptions="StartAndExpand">
<ListView.ItemTemplate>
<DataTemplate >
<ViewCell>
<StackLayout>
<Image Source = "{Binding Urlimage}" WidthRequest = "400" Margin="0,-200" HeightRequest = "500" MinimumHeightRequest = "500" MinimumWidthRequest = "400" />
<StackLayout Margin="0,45" >
<Label Text = "{Binding Title}" FontSize = "15" TextColor = "Black"/>
<Label Text = "{Binding MiniContent}" FontSize = "12" TextColor = "Gray" Margin="0,-7"/>
</StackLayout>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Frame>
<Frame>
<ListView x:Name = "MainMagazine2" RowHeight="200" ItemSelected="MainMagazine_se" VerticalOptions="Center" >
<ListView.ItemTemplate>
<DataTemplate >
<ViewCell>
<StackLayout Padding="0,0,0,300">
<Image Source = "{Binding Urlimage}" WidthRequest = "400" Margin="0,-200" HeightRequest = "500" MinimumHeightRequest = "500" MinimumWidthRequest = "400" />
<StackLayout Margin="0,45" >
<Label Text = "{Binding Title}" FontSize = "15" TextColor = "Black"/>
<Label Text = "{Binding MiniContent}" FontSize = "12" TextColor = "Gray" Margin="0,-7"/>
</StackLayout>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Frame>
【问题讨论】:
-
使用 2 行的网格,每行 50%。然后在每一行放置一个ListView
-
Jason,你能告诉我怎么做吗?
-
你能告诉我们你到底想达到什么目标吗?
-
如果您在顶部看到新图像,您可以在中心看到两个列表剪切。我不想要那个,我想要两个列表,但不要在屏幕上剪切,就像 link
-
所以你希望能够将第一个向下滚动到最后,然后第二个列表视图应该出现?
标签: c# xaml xamarin xamarin.forms