本文介绍了在Xamarin.Forms ScrollView中水平滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用Xamarin.Forms并创建了一个ScrollView,其中包含一个水平StackLayout.我希望能够水平滚动,所以我设置:
I am using Xamarin.Forms and have created a ScrollView, which contains a horizontal StackLayout. I want to be able to scroll horizontally, so I set:
Orientation = ScrollOrientation.Horizontal;
但是我没有水平滚动. StackLayout的内容比屏幕宽,我看到内容在边缘被剪切.
But I don't get horizontal scroll. The content of the StackLayout is wider than the screen, and I see the content is being clipped at the edge.
如何使用Xamarin.Forms实现水平滚动?
How do I achieve horizontal scroll with Xamarin.Forms ?
推荐答案
这就是我的工作方式
var scrollView = ScrollView
{
HorizontalOptions = LayoutOptions.Fill,
Orientation = ScrollOrientation.Horizontal,
Content = new StackLayout{
Orientation = StackOrientation.Horizontal,
Children = {}
}
};
这篇关于在Xamarin.Forms ScrollView中水平滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!