Android的软键盘覆盖EDITTEXT景观

问题描述:

我有以下布局:Android的软键盘覆盖EDITTEXT景观

<?xml version="1.0" encoding="utf-8"?> 

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
       android:layout_width="fill_parent" 
       android:layout_height="fill_parent"> 

    <LinearLayout 
      android:layout_height="wrap_content" 
      android:layout_width="fill_parent" 
      android:orientation="vertical" 
      android:layout_above="@+id/edittext"> 

     <TextView 
       android:layout_height="wrap_content" 
       android:layout_width="fill_parent" 
       android:text="line1"/> 

     <TextView 
       android:layout_height="wrap_content" 
       android:layout_width="fill_parent" 
       android:text="line2"/> 

     <TextView 
       android:layout_height="wrap_content" 
       android:layout_width="fill_parent" 
       android:text="line3"/> 

    </LinearLayout> 

    <EditText 
      android:id="@id/edittext" 
      android:layout_height="wrap_content" 
      android:layout_width="fill_parent" 
      android:layout_margin="5dp" 
      android:text="test" 
      android:layout_alignParentBottom="true" 
      android:imeOptions="flagNoExtractUi" 
      /> 
</RelativeLayout> 

,并在Nexus的一道风景线,它看起来像:

enter image description here

有没有办法解决这个问题,但保持国旗flagNoExtractUi?

+0

一些可能的答案是在给定链路上给出: http://*.com/questions/3295672/android-soft-keyboard-covers-edittext-field – 2012-08-06 09:51:13

+0

请检查我的【答案】(HTTP:// *.com/a/11822354/996493)。 – Lucifer 2012-08-06 09:51:44

+0

你试过androidife:windowSoftInputMode =“stateVisible | adjustResize”在menifest文件中的activity标签中http://developer.android.com/guide/topics/manifest/activity-element.html#wsoft – rajpara 2012-08-06 09:53:52

您可以添加ScrollView,以便在出现键盘时自动滚动以使视图完全可见。

定义<activity>内Android清单一样:

<activity android:name=".TodoEdit" 
      android:windowSoftInputMode="adjustResize"> 
+0

我已经这样做,但它不起作用。看到我的最后一个问题 – 2012-08-06 10:05:16

+0

这是什么标志* flagNoExtractUi *,在Android中第一次听到。 – 2012-08-06 10:06:34

+0

用于指定IME不需要显示其提取的文本UI。对于可能是全屏的输入方法,通常在横向模式下时,这允许它们更小,并让部分应用程序显示在后面。虽然用户可能获得的应用程序访问权限有限,但它可以使(大部分)全屏幕IME的体验不那么震撼。请注意,指定此标志时,IME可能无法设置为能够显示文本,因此只能在不需要此情况的情况下使用。 – 2012-08-06 10:14:48

这似乎是在Android的一个错误,但我发现了一个解决方案!只需将android:imeOptions="flagNoExtractUi"替换为android:imeOptions="flagNoFullscreen",现在一切都可以正常工作。