Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ScrollView inside a RecyclerView android

I am currently working with recyclerView and cards.

I have a cards layout. Now i want to add scrollview inside the cards is that possible. If yes then how ? The brown layout is the recycler view layout while the blue layout is the cards layout. Inside each card i need a scrollview is that possible ?

enter image description here

like image 606
Sagar Devanga Avatar asked Mar 16 '23 13:03

Sagar Devanga


1 Answers

I am not sure if this will work but you can try this

  • Disable the touch of recycler view when scrollview is being touched.
  • Similarly disable scrollview touch on recyclerview touch.

This can be acheived like this

//For scrollView

   scrollView.setOnTouchListener(new View.OnTouchListener() {
                @Override
                public boolean onTouch(View view, MotionEvent motionEvent) {
                     // Disallow the touch request for parent scroll on touch of child view
                    view.getParent().requestDisallowInterceptTouchEvent(false);
                    return true;
                }
            }); 

see if this helps you.

like image 99
Ankit Khare Avatar answered Mar 28 '23 18:03

Ankit Khare