2014-10-05 78 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