Siraj Sumra
Siraj Sumra

Reputation: 964

Edittext scrolling inside Recyclerview and NestedScrollView android

I have an edittext which is of inputType textMultiLine inside RecyclerView which again is in NestedScrollView. I have a functionality in which I have to take Recyclerview inside the NestedScrollview. RecyclerView scrolling has been disabled by NestedScrollingEnabled as false. Inside this Recyclerview, there is an itemtype which has edittext in it. This edittext is Multiline and of 100 dp, If vertically, the content won't fit, the content will get cut, cause of max height. So How can I make my edittext scrollable inside Nested Scroll View

I have enabled Edittext scrolling with the following code:

<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?

Upvotes: 4

Views: 3189

Answers (1)

Hemant Parmar
Hemant Parmar

Reputation: 3976

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!!

Upvotes: 4

Related Questions