RecyclerViewEditText点击弹出软键盘后焦点丢失
破问题在网上找了很多帖子都没解决,但是我另外一个界面就一点事没有,因为我的RecyclerView是在NestedScrollView下的,所以就试着给它包了一层布局,里面只有RecyclerView(之前在ConstraintLayout下面,里面还有其他控件),这次运行后没问题了。
最后反思了一下,应该是ScrollView导致的焦点冲突,软键盘弹起后焦点回到了RecyclerView父布局也就是ScrollView身上,但把RecyclerView额外包裹一层后RecyclerView的父布局就不再是ScrollView了。
附上布局
-
<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="wrap_content"
-
android:background="@color/white"
-
android:padding="@dimen/twelve">
-
-
<TextView
-
android:id="@ id/question_text"
-
android:layout_width="wrap_content"
-
android:layout_height="wrap_content"
-
android:layout_marginTop="@dimen/twelve"
-
android:text="啊啊"
-
android:textColor="@color/mine_tablayout_text_blue"
-
android:textSize="@dimen/small_text"
-
app:layout_constraintStart_toStartOf="parent"
-
app:layout_constraintTop_toTopOf="parent" />
-
-
<TextView
-
android:id="@ id/question_mark"
-
android:layout_width="wrap_content"
-
android:layout_height="wrap_content"
-
android:layout_marginLeft="@dimen/three"
-
android:text="啊啊啊啊"
-
android:textColor="@color/mine_tablayout_text_blue"
-
android:textSize="@dimen/small_text"
-
android:visibility="gone"
-
app:layout_constraintEnd_toEndOf="parent"
-
app:layout_constraintTop_toTopOf="@ id/question_text" />
-
-
<RelativeLayout
-
android:layout_width="0dp"
-
android:layout_height="wrap_content"
-
app:layout_constraintBottom_toBottomOf="parent"
-
app:layout_constraintEnd_toEndOf="@ id/question_mark"
-
app:layout_constraintStart_toStartOf="@ id/question_text"
-
app:layout_constraintTop_toBottomOf="@ id/question_text">
-
-
<android.support.v7.widget.RecyclerView
-
android:id="@ id/question_options"
-
android:layout_width="match_parent"
-
android:layout_height="wrap_content" />
-
-
</RelativeLayout>
-
-
</android.support.constraint.ConstraintLayout>
-
</android.support.v4.widget.NestedScrollView>
这篇好文章是转载于:学新通技术网
- 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
- 本站站名: 学新通技术网
- 本文地址: /boutique/detail/tanhhaaahh
系列文章
更多
同类精品
更多
-
photoshop保存的图片太大微信发不了怎么办
PHP中文网 06-15 -
《学习通》视频自动暂停处理方法
HelloWorld317 07-05 -
word里面弄一个表格后上面的标题会跑到下面怎么办
PHP中文网 06-20 -
Android 11 保存文件到外部存储,并分享文件
Luke 10-12 -
photoshop扩展功能面板显示灰色怎么办
PHP中文网 06-14 -
微信公众号没有声音提示怎么办
PHP中文网 03-31 -
excel下划线不显示怎么办
PHP中文网 06-23 -
excel打印预览压线压字怎么办
PHP中文网 06-22 -
TikTok加速器哪个好免费的TK加速器推荐
TK小达人 10-01 -
怎样阻止微信小程序自动打开
PHP中文网 06-13