xamarin.Forms只滚动页面的一部分

时间:2014-10-05 11:49:59

标签: layout xamarin scrollview

我有一个页面,我希望顶部始终显示标题,底部始终显示按钮。中间的内容是可滚动的。

我认为通过以下操作会很容易:

StackLayout outer = new StackLayout();

StackLayout inner = new StackLayout();//with all of the content added

ScrollView scroll = new ScrollView();


outer.Children.Add(headerLabel);//non-scrolling

scroll.Content = inner;

outer.Children.Add(scroll);      //scrolling

outer.Children.Add(button);     //non-scrolling

headerLabel和按钮保持在正确位置,但内容向上滚动到页面顶部,在headerLabel的顶部(但在底部按钮的下方/下方)。

我很肯定它工作正常,但我记不起任何改变。

有没有人知道为什么会发生这种情况?

1 个答案:

答案 0 :(得分:6)

所以这个修好了

outer.VerticalOptions = LayoutOptions.End;

scroll.IsClippedToBounds=true;
相关问题