键盘可见时,Recyclerview项目不可见/丢失

时间:2019-09-12 09:01:49

标签: android android-recyclerview scrollview android-nestedscrollview

问题:

我的recyclerview项只有一个edittext。

如果用户编辑edittext->键盘将出现,并且缺少一些列表项。(表示在键盘关闭后,recyclerview缩小后recyclerview不会展开,这意味着recyclerview会缩小)

我的xml设计

<ScrollView>
<ConstraintLayout>
  <other views>
  <recyclerview/>
</ConstraintLayout>
</ScrollView>

清单活动窗口SoftInputMode

 android:windowSoftInputMode="adjustPan"

尝试了很多Google&SO。但是没有运气。有人给我解决办法。如果有人需要更多信息,请告诉我。我会提供更多细节。

更新:

我的xml代码-https://pastebin.com/diz4t9mp

我的问题-视频参考

https://drive.google.com/file/d/15J4hOnCM7Gu6uvklhzlSSD7XUCmmGmzg/view?usp=sharing

1 个答案:

答案 0 :(得分:1)

更改此

<ScrollView>
<ConstraintLayout>
  <other views>
  <recyclerview/>
</ConstraintLayout>
</ScrollView>

<android.support.v4.widget.NestedScrollView>
<ConstraintLayout>
  <other views>
  <recyclerview/>
</ConstraintLayout>
</android.support.v4.widget.NestedScrollView>
  

NestedScrollView用于需要滚动视图的情况   在另一个滚动视图中。通常这很难   完成,因为系统将无法决定要查看哪个视图   scroll,它支持在新旧版本的Android上同时充当嵌套滚动父级和子级。