[英]Edittext scrolling inside Recyclerview and NestedScrollView android
I have an edittext which is of inputType textMultiLine inside RecyclerView which again is in NestedScrollView. 我在RecyclerView中有一个inputText textMultiLine的edittext,它又在NestedScrollView中。 I have a functionality in which I have to take Recyclerview inside the NestedScrollview.
我必须在NestedScrollview中使用Recyclerview。 RecyclerView scrolling has been disabled by NestedScrollingEnabled as false.
NestedScrollingEnabled已将RecyclerView滚动禁用为false。 Inside this Recyclerview, there is an itemtype which has edittext in it.
在此Recyclerview中,有一个itemtype,其中包含edittext。 This edittext is Multiline and of 100 dp, If vertically, the content won't fit, the content will get cut, cause of max height.
此编辑文本为多行且100 dp,如果垂直放置,则内容将无法容纳,内容将被剪切,这是最大高度的原因。 So How can I make my edittext scrollable inside Nested Scroll View
因此,如何使我的edittext在嵌套滚动视图中可滚动
I have enabled Edittext scrolling with the following code: 我使用以下代码启用了Edittext滚动:
<EditText
android:id="@+id/etYesDescription"
style="@style/EditTextStyle"
android:layout_width="match_parent"
android:layout_height="100dp"
android:inputType="textMultiLine"
android:imeOptions="actionDone"
android:overScrollMode="always"
android:scrollbarStyle="insideInset"
android:scrollbars="vertical" />
But it is still not scrollable, How can I make my Edittext scroll work? 但是它仍然不能滚动,如何使Edittext滚动工作?
You can achieve by this programmatically have look 您可以以此方式实现外观
EditText etYesDescription= (EditText) findViewById(R.id.etYesDescription);
etYesDescription.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (v.getId() == R.id.comment1) {
v.getParent().requestDisallowInterceptTouchEvent(true);
switch (event.getAction() & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_UP:
v.getParent().requestDisallowInterceptTouchEvent(false);
break;
}
}
return false;
}
});
Hope it will help you!! 希望对你有帮助!!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.