【问题标题】:Why the android keyboard cover my EditText? [duplicate]为什么 android 键盘会覆盖我的 EditText? [复制]
【发布时间】:2015-11-13 17:13:53
【问题描述】:

我在我的应用程序的按钮上定义了 EditText 它看起来像这样:

但是当我专注于 Notes 的 EditText 时,键盘打开并覆盖了我的所有 EditText,我看不到我在 EditText 中输入的内容。

当我隐藏键盘时,我看到了我输入的正确文本。

EditText的LinearLayout的xml:

<LinearLayout
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:text="Notes:"
        android:id="@+id/textView"
        android:textColor="#000000" />

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/editText"
        android:focusable="true" />

</LinearLayout>

【问题讨论】:

    标签: android


    【解决方案1】:

    您可能需要在清单中的活动中使用 windowSoftInputMode 属性。有点像这样:

    <activity name="YourActivity"
        android:windowSoftInputMode="adjustPan">
        ...
    </activity>
    

    检查这些链接: Android soft keyboard covers edittext field

    http://android-developers.blogspot.com/2009/04/updating-applications-for-on-screen.html

    【讨论】:

      【解决方案2】:

      解决此问题的唯一方法是将文本框放在不同的位置。

      想一想...您真的希望您的文本框位于键盘上方吗?

      这是一个相当普遍的问题,在设计布局时应该始终考虑到这一点。

      【讨论】:

      • 没有..但UI设计是我做的。
      • 必须有其他解决方案 - 我在其他应用程序中也是如此。
      【解决方案3】:

      所以这解决了我的问题(感谢@Coeus)

      我在清单上定义了这一行

            android:windowSoftInputMode="adjustPan"
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-08-05
        • 1970-01-01
        • 1970-01-01
        • 2015-11-22
        相关资源
        最近更新 更多