ScrollView重叠

时间:2017-01-11 11:13:28

标签: xamarin xamarin.forms

我尝试在两个StackLayouts之间放置ScrollView StackLayout但是当我滚动ScrollView内的元素时,这些项始终与上级StackLayout重叠在图像中:

ScreenShot http://image.prntscr.com/image/94ee77b1ccd9492bb416976cf2d8202a.png

我使用的代码是:

stackPrinc = new StackLayout()
{
    Spacing = 0,
    HorizontalOptions = LayoutOptions.FillAndExpand,
    Children = {
        ly_sup,
        new ScrollView() { Content = ly_main, IsClippedToBounds = true, BackgroundColor = Color.Olive },
        ly_inf },
};

1 个答案:

答案 0 :(得分:3)

我解决了它,当一个元素在他上面和下面有一个元素时,它就会发生一个bug。我的新代码是;

stackPrinc = new StackLayout()
        {
            Spacing = 0,
            Children = {
                ly_sup,
                new StackLayout() { Children =  { new ScrollView() { Content = ly_main, IsClippedToBounds = true, BackgroundColor = Color.Aqua, } } },
                ly_inf,
            },
        };