Xamarin Forms中的滚动编辑器进入视图 [英] Scroll editor in Xamarin Forms into view
问题描述
使用Xamarin Forms,考虑下面的Xaml。
Using Xamarin Forms, consider the Xaml below.
<StackLayout VerticalOptions="FillAndExpand">
<Image x:Name="cameraImage" Source="camera.png" />
<Label Text="Describe the image" />
<Editor />
<Button Text="Save" />
</StackLayout>
这会渲染图像,编辑器和保存按钮。图像的图像比例为4x3,覆盖了可用屏幕高度的三分之一。编辑器呈现如下。
This renders an image, an editor and a save button. The image is in 4x3 image ratio and covers about a third of the available screen height. The editor is rendered below.
问题是键盘覆盖了iOS中的编辑器。通常是标准的iOS问题。
The problem is that the keyboard covers the Editor in iOS. A standard iOS issue normally.
问题是:Xamarin Forms处理此问题的方式是什么?
The question is: What is the Xamarin Forms way of handling this?
谢谢
// Johan
推荐答案
使用Xamarin.Forms自动滚动编辑器和条目,你通常只需要将你的View(在本例中为StackLayout)打包到ScrollView中:
To get auto scroll for Editors and Entries with Xamarin.Forms, you usually just have to pack your View, in this case the StackLayout, into a ScrollView:
<ScrollView>
<StackLayout VerticalOptions="FillAndExpand">
<Image x:Name="cameraImage" Source="camera.png" />
<Label Text="Describe the image" />
<Editor />
<Button Text="Save" />
</StackLayout>
</ScrollView>
这就是它应该如何工作,但截至今天(2014年6月),有一个错误阻止这个完全使用编辑器(它适用于条目)。这个问题已知并正在研究中。
That's how it's supposed to work, but as of today (June 2014) there's a bug preventing this to work fully with the Editor (it works well with Entries). The issue is known and is worked on.
[更新2014-11-20]该问题已得到解决,并将在下一个XF版本中提供1.3
[UPDATE 2014-11-20]The issue has been addressed, and will be available in the next -pre release of XF 1.3
这篇关于Xamarin Forms中的滚动编辑器进入视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!