ExpandableLayout
ExpandableLayout copied to clipboard
Problem with allowing nested scrolling inside expandable layout
I made the following hierarchy - RecyclerView with ExpandableLayout that has RecyclerView in itself and i just cant find a way to allow scrolling inside that nested recycler view, i tried with setNestedScrollingEnabled(true) but it won't help, can you help me with this if it is even possible to implement in this way? Thank you in advance :)
Just intercept the touch event in the nested recycler view and everything should work. Just implemented it with this library and is working smoothly.
holder.childRecyclerView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { // disallow the onTouch for your scrollable parent view v.getParent().requestDisallowInterceptTouchEvent(true); return false; } });
@yosrah Thanks! :+1:
@milos1991 Do you solve this issue?
I don't recommend the ExpandableLayout has complicated children. Maybe you should set a fixed height to children if you use the RecyclerView in ExpandableLayout.
Thanks for the reply, both of you. I've tried with requestDissalow method wont allow scrolling. It intercepts scrolling on parent rv, however child rv is still not able to scroll. Funny thing is - when using ScrollView and requestDissalow, it works perfectly.
@milos1991 Did you set a fixed height for the nested recycler view ?
Yes, it was fixed.
@milos1991 I haven't done anything extra than that and it's working fine . Maybe if you can post some code then we could identify where the problem is.
Then its definitely problem in my code, i will double check my code then and if i don't fix it, i will post it here. Thank you very much for helping. :)
:+1:
Thank you yosrah, really you helped me a lot!.