I have a RecyclerView, and each ViewHolder has another RecyclerView. However only the parent RecyclerView gets focus and the child RecyclerView does not ever get any focus.
I need the child to get focus so it can scroll. Has anyone managed to do that?
Related
I'm trying to design a row list using RecyclerView like Android TV ↳ android.support.v17.leanback.widget.ListRow. I'm able to design list with title but not row list. Can anyone help me?
Please Follow this Link for
Recycer view like play store
Use Two RecyclerView Outer Recycler is vertical and Second horizontal recycler is item of first recycler View
All you need is to call mInnerRecycler.setNestedScrollingEnabled(false); on your inner RecyclerViews and use Horizontal scrollview as root of mInnerRecyclerView
Explanation:
RecyclerView has support for nested scrolling introduced in API 21 through implementing the NestedScrollingChild interface. This is a valuable feature when you have a scrolling view inside another one that scrolls in the same direction and you want to scroll the inner View only when focused.
In any case, RecyclerView by default calls RecyclerView.setNestedScrollingEnabled(true); on itself when initializing. Now, back to the problem, since both of your RecyclerViews are within the same ViewPager that has the AppBarBehavior, the CoordinateLayout has to decide which scroll to respond to when you scroll from your inner RecyclerView; when your inner RecyclerView's nested scrolling is enabled, it gets the scrolling focus and the CoordinateLayout will choose to respond to its scrolling over the outer RecyclerView's scrolling. The thing is that, since your inner RecyclerViews don't scroll vertically, there is no vertical scroll change (from the CoordinateLayout's point of view), and if there is no change, the AppBarLayout doesn't change either.
In your case, because your inner RecyclerViews are scrolling in a different direction, you can disable it, thus causing the CoordinateLayout to disregard its scrolling and respond to the outer RecyclerView's scrolling.
Notice:
The xml attribute android:nestedScrollingEnabled="boolean" is not intended for use with the RecyclerView, and an attempt to use android:nestedScrollingEnabled="false" will result in a java.lang.NullPointerException so, at least for now, you will have to do it in code.
RecyclerView can check View Type for return header or item. And use layout manager for manage how to item scrolling direction.
RecyclerView (vertical scrolling)
- item -> RecyclerView (horizontal scrolling) check view type is header or item with condition example : is object has type header
Ref : Google play store like interface using recycler view
I'm sure there is a simple solution of which I'm just not aware. I have a nested RecyclerView like this.
The outer RecyclerView has vertical scrolling with an attached ItemTouchHelper so that swiping left triggers swipe-to-delete behavior. The inner RecyclerView has horizontal scrolling.
Problem: swiping behavior in the ViewHolder, including trying to scroll the RecyclerView therein, triggers the swiping behavior.
Solution?: disable swipe-to-delete behavior for part of the ViewHolder. In this case, it would be disabled if the RecyclerView is scrolled/swiped. Conversely, it can only be enabled if a view inside the ViewHolder is swiped, like the header.
Any ideas?
My RecyclerView has 2 type of ViewHolder inside it, one whose parent layout is CardView and another one is ViewPager. My issue is that when RecyclerView scrolls vertically, its stops scroll at ViewPager and can't scroll further on touching ViewPager. If i try to scroll on CardView row it works fine.
I have a Recyclerview inside another RecyclerView, the inner recyclerview item views are clickable. When I click any item view in the inner recyclerview, it is not scroll to top, I tried using scrollToPosition(position) and scrollTo(X, Y) methods but no luck. I guess I have to scroll the outter recyclerview to achieve it, but don't know how to scroll parent recyclerview from child recyclerview. Can somebody help me on this?
Regards,
Rajapandian.
My activity contains an AppBarLayout provided by the design library 23.0.1, it hides when I scroll up. I have a RecyclerView with each child item containing a RecyclerView too, basically a nested RecyclerView going on.
My issue is that when I touch on any of the inner RecyclerView's child and scroll up, the AppBar does not hide. However, if I place my finger somewhere else (not on the inner RecyclerView) and scroll, the app bar scrolls up just fine. Why is this happening? I even tried adding the appbar behavior for the inner recycler view, yet the app bar would only scroll up when I touch somewhere else and scroll.
Note: the inner recyclerview has a fixed set of items that would be visible at all times, basically, there is no scrolling within the recyclerview.
There is a similar question and a provided solution would be to intercept the touch of the inner recyclerview and pass it to the parent recycler view. But this disables the click events of the children in the inner recycler view, I do not want that.
You need to set the nested scrolling flag to false for inner recycler views.
mSomeInnerRecyclerView.setNestedScrollingEnabled(false);