【问题标题】:EditText gets pushed off screenEditText 被推离屏幕
【发布时间】:2018-08-09 07:29:15
【问题描述】:

我的屏幕带有NestedScrollView,垂直LinearLayout 包含片段、Recycler 和另一个片段。当我单击并聚焦EditText 在回收者的一项项目中时,软键盘弹出并将其推离屏幕。活动的windowSoftInputMode 设置为stateAlwaysHidden|adjustResize

以前有人遇到过这个问题吗?

布局:

<layout xmlns:android="http://schemas.android.com/apk/res/android">
  <android.support.v4.widget.NestedScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/background"
    >
    <LinearLayout
      android:orientation="vertical"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      >
      <com.trinerdis.skypicker.widget.SupportFragmentLayout
        android:id="@+id/first_fragment_container"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        />
      <android.support.v7.widget.RecyclerView
        android:id="@+id/middle_recycler_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:overScrollMode="never"
        android:scrollbars="none"
        android:listSelector="@android:color/transparent"
        android:divider="@null"
        android:dividerHeight="0dp"
        />
      <com.trinerdis.skypicker.widget.SupportFragmentLayout
        android:id="@+id/second_fragment_container"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:padding="@dimen/margin_medium"
        />
      <include
        android:id="@+id/info"
        layout="@layout/layout_info"
        />
    </LinearLayout>
  </android.support.v4.widget.NestedScrollView>
</layout>

【问题讨论】:

  • 添加有问题的相关代码。信息不足。
  • Android 与多个嵌套的可滚​​动布局一起工作很糟糕,您应该将 recyclerview(这是一个可滚动布局)移到 NestedScrollView 之外

标签: android android-layout android-recyclerview fragment android-softkeyboard


【解决方案1】:

结果我并没有像我想的那样尝试所有选项,通过将 windowSoftInputMode="stateAlwaysHidden|adjustResize" 更改为 windowSoftInputMode="stateAlwaysHidden|adjustPan" 解决了这个问题

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多