简体   繁体   English

Recyclerview和NestedScrollView android内部的Edittext滚动

[英]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.

相关问题 RecyclerView 不在 NestedScrollView 内滚动 - RecyclerView not scrolling inside NestedScrollView NestedScrollView内的RecyclerView滚动问题 - RecyclerView inside NestedScrollView scrolling issue NestedScrollview中的RecyclerView无法平滑滚动 - RecyclerView inside NestedScrollview not scrolling smoothly NestedScrollView Android中的RecyclerView - RecyclerView inside NestedScrollView Android Android recyclerView内NestedScrollView水平滚动很难做到 - Android recyclerView inside NestedScrollView Horizontal Scrolling hard to do 带有多个RecyclerView和一个ViewPager的内容不在NestedScrollView中滚动 - Content with multiple RecyclerView and a ViewPager not scrolling inside NestedScrollView 如何在nestedscrollview中使用无限滚动recyclerview? - How to use infinite scrolling recyclerview inside nestedscrollview? nestedscrollview滚动问题内的片段中的Recyclerview - Recyclerview in fragment which is inside nestedscrollview scrolling issue NestedScrollView 不在 CoordinatorLayout 内滚动 - Android - NestedScrollView not scrolling inside CoordinatorLayout - Android ListView 不在 Android 中的 NestedScrollView 内滚动 - ListView is not scrolling inside NestedScrollView in android
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM