Xamarin形式:开启键盘时,UI中不显示顶部堆栈布局

时间:2018-12-03 12:41:33

标签: xamarin.forms stacklayout

我的Xaml:

<StackLayout
   Orientation="Vertical">

   <StackLayout
      Orientation="Horizontal"> 
      //Group labels and back arrow
   </StackLayout>

   <ListView>
      //Message list
   </ListView>

   <Grid>
   //Plus symbol,Editor and send icon
   </Grid>

</StackLayout>

截屏:

enter image description here

问题:

在正常屏幕中,顶部有一个栏(红色圆圈)。单击时,底部顶部栏上的编辑器将隐藏。我需要始终在顶部的顶部栏。 此问题仅在IOS部分中,在android中,此功能运行正常。如何解决此问题?

2 个答案:

答案 0 :(得分:0)

Its an iOS feature that the UI is adjusted upwards. You can shrink (or keep) the view via a custom renderer.

Check this great explanation.

And also this peace of code for a keyboard custom renderer on iOS.

答案 1 :(得分:0)

就像问题中的图片一样,我的软键盘始终触摸编辑器。因此,我为我的编辑器添加了一个自定义渲染器,以解决该问题。 添加该自定义渲染器后,顶部栏始终停留在页面顶部。

我使用以下自定义渲染器解决了键盘重叠的问题:

react-native link