2017-08-02 82 views
1

我有一个recyclerView,高度和宽度为matchParent,高于和低于某些视图。查看下面recyclerVieweditText。当在editText中输入某些内容并键盘关闭时,recyclerView将滚动到顶部。任何想法为什么它正在发生以及如何解决。RecyclerView在键盘隐藏后滚动到顶部

相关的XML在:https://gist.github.com/anonymous/42c38f8a50daf0f441552c985e29a309

+0

ü可以添加你的XML代码 – Anil

+0

我家这有助于: HTTPS ://stackoverflow.com/questions/45458054/why-does-recyclerview-scroll-to-top-of-view-when-view-is-focused 我认为这是同样的问题。 –

+0

使用自定义线性布局管理器 – Piyush

回答

2

你可以尝试将此代码添加到您的清单:

android:windowSoftInputMode="adjustPan" 

<activity 
    android:name=".YourActivity" 
    android:configChanges="keyboard|keyboardHidden" 
    android:label="@string/title_activity" 
    android:windowSoftInputMode="adjustPan" 
    > 

编辑

+0

@seema你可以尝试android:windowSoftInputMode =“adjustPan” –

+0

这是行之有效的?与你@seema –

+0

adjustpan工作... – seema