android – 当在ListView或RecyclerView中集中EditText时,键盘显示但滚动不起作用

android – 当在ListView或RecyclerView中集中EditText时,键盘显示但滚动不起作用,第1张

概述当我触摸ListView或RecyclerView内的EditText时,显示键盘.然后我点击键盘上的下一个按钮,焦点变为下一个EditText.在最后一个可见的EditText之后,焦点变为下一个EditText但ListView或RecyclerView没有在里面滚动,所有屏幕都在状态栏下每个键盘下一个Button点击. 以下用于此屏幕的xml: <?xml version="1.0" en 当我触摸ListVIEw或RecyclerVIEw内的EditText时,显示软键盘.然后我点击键盘上的下一个按钮,焦点变为下一个EditText.在最后一个可见的EditText之后,焦点变为下一个EditText但ListVIEw或RecyclerVIEw没有在里面滚动,所有屏幕都在状态栏下每个键盘下一个button点击.

以下用于此屏幕的xml:

<?xml version="1.0" enCoding="utf-8"?>    <linearLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"        xmlns:app="http://schemas.androID.com/apk/res-auto"        androID:layout_wIDth="match_parent"        androID:layout_height="match_parent"        androID:orIEntation="vertical">        <include            androID:ID="@+ID/MainToolbar"            layout="@layout/toolbar" />        <include            androID:ID="@+ID/llheaderItem"            layout="@layout/TaskshelfShareheaderItem" />        <ListVIEw            androID:ID="@+ID/lwShelfShare"            androID:layout_wIDth="match_parent"            androID:layout_height="match_parent"            androID:stackFromBottom="true"            androID:transcriptMode="normal" />    </linearLayout>
解决方法 我这样想了.希望能帮助到你.
mEditText.setonEditorActionListener(new TextVIEw.OnEditorActionListener() {    @OverrIDe    public boolean onEditorAction(TextVIEw v,int actionID,KeyEvent event) {        RecyclerVIEw recyclerVIEw = getRecyclerVIEw();        if (recyclerVIEw != null) {            int position = getLayoutposition();            RecyclerVIEw.VIEwHolder vIEwHolder = recyclerVIEw.findVIEwHolderForLayoutposition(position + 1);            if (vIEwHolder == null) {                recyclerVIEw.smoothScrollToposition(position + 1);                return true;            }        }        return false;    }});
总结

以上是内存溢出为你收集整理的android – 当在ListView或RecyclerView中集中EditText时,键盘显示但滚动不起作用全部内容,希望文章能够帮你解决android – 当在ListView或RecyclerView中集中EditText时,键盘显示但滚动不起作用所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1130499.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-30
下一篇 2022-05-30

发表评论

登录后才能评论

评论列表(0条)

保存