我有一个Edittext
视图,可以对Edittext
中的Feed发表评论。当我在Edittext's
中放入大量文字并且滚动条出现时,我无法滚动Recyclerview
文字内容。当我要在Edittext
中滚动时,{{1}}会向上滚动。我怎么能解决这个问题。请建议。
答案 0 :(得分:2)
textInputField.setOnTouchListener { v, _ ->
v.parent.requestDisallowInterceptTouchEvent(true)
false
}
答案 1 :(得分:0)
在android:nestedScrollingEnabled="true"
上使用android:scrollbars="vertical"
,android:overScrollMode="ifContentScrolls"
,EditText
。
答案 2 :(得分:0)
在没有看到一些代码可供参考的情况下解决问题总是一个挑战,但一个猜测可能是:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent">
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="74dp"
android:text="Add Task"
android:textSize="18sp" />
<EditText
android:id="@+id/editText"
android:focusable="true"
android:focusableInTouchMode="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/textView"
android:layout_centerHorizontal="true"
android:layout_marginTop="22dp"
android:ems="10"
android:inputType="text"
android:text="Title" />
<Button
android:id="@+id/closeButton2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/editText"
android:layout_alignStart="@+id/editText"
android:layout_below="@+id/editText"
android:layout_marginTop="28dp"
android:text="Cancel" />
<Button
android:id="@+id/addButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/closeButton2"
android:layout_alignBottom="@+id/closeButton2"
android:layout_alignEnd="@+id/editText"
android:layout_alignRight="@+id/editText"
android:text="Add Task" />
</RelativeLayout>
中的EditText
,您可以在RecyclerView
上调用setFocusable(boolean)以从触摸输入获得焦点在焦点处理和触摸模式下查看EditText
上的Google文档,看看它是否有助于解决您的问题。
https://developer.android.com/reference/android/view/View.html