2014-10-05 80 views
5

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

我认为这将是通过执行以下操作简单:

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和按钮停留在corrrect位置,但内容向右滚动到页面的顶部,在顶部headerLabel(但位于底部按钮下方/下方)。

我很积极,它工作正常,但我不记得任何改变。

有没有人对此有何想法?

+1

inner.Children.Add(内);盗梦空间? :) – 2014-10-05 14:45:07

+0

编译时使用Android API版本23恢复编译和目标到22,并修复它时有此问题。因此可能与您定位的API版本有关或者目标和值不相同。 @MihaMarkic修复作为一个临时工,直到我发现问题。 – SatanEnglish 2015-12-07 01:11:43

回答

5

所以这个固定

outer.VerticalOptions = LayoutOptions.End; 

scroll.IsClippedToBounds=true; 
+0

很好的回答!完美的作品。 – Blounty 2014-12-16 02:09:11

+0

嗨,我有点类似的问题?你可以看看这里:http://stackoverflow.com/questions/27990161/xamarin-forms-scrollview-keyboard-appears-and-button-also-scroll – SoftSan 2015-01-16 18:19:35

相关问题