Android 为什么当键盘出现时,RecyclerView项被破坏?
我的布局结构如下:Android 为什么当键盘出现时,RecyclerView项被破坏?,android,Android,我的布局结构如下: NestedScrollView ConstrainstsLayout SearchView RecyclerView RecyclerView 当我点击SearchView时,键盘出现,底部RecyclerView的项目变大。无法同时查看RecyclerView的项目。他们只一个接一个地展示,因为他们的身高,在展示键盘后变得更大。那么,如何解决这个问题呢?这是布局图 <layout xmlns:android="http:/
NestedScrollView
ConstrainstsLayout
SearchView
RecyclerView
RecyclerView
当我点击SearchView
时,键盘出现,底部RecyclerView
的项目变大。无法同时查看RecyclerView
的项目。他们只一个接一个地展示,因为他们的身高,在展示键盘后变得更大。那么,如何解决这个问题呢?这是布局图
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="viewModel"
type="tech.nplus.yaptk.ui.payment.PaymentViewModel" />
</data>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.SearchView
android:id="@+id/searchView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
app:iconifiedByDefault="false"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:queryHint="@string/find_service"
/>
<android.support.v7.widget.RecyclerView
android:id="@+id/fast_payment_rv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginTop="10dp"
android:orientation="horizontal"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/searchView" />
<android.support.v7.widget.RecyclerView
android:id="@+id/service_list_parent_rv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="vertical"
app:items="@{viewModel.items}"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/fast_payment_rv"
/>
</android.support.constraint.ConstraintLayout>
</android.support.v4.widget.NestedScrollView>
另外,我将android:windowSoftInputMode=“adjustPan”
,否则,我的BottomNavigationView
将显示在键盘上方 发布一些屏幕截图您可以在AndroidManifest.xml中为当前活动使用android:WindowsOfInputMode=“StateAllwayShidden | adjustResize”,并在样式或根布局中使用android:fitsSystemWindows=“true”。@MaxAves发布了一些屏幕截图。@Madhur没有帮助。BottomNavigationView显示在您的解决方案的键盘上方现在我们确实需要xml文件