Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

recyclerview inside scroll view affects scroll position

Tags:

android

I have the following layout structure

  --FrameLayout
    --scrollview
       --LinearLayout
          --LinearLayout
          --RecyclerView
    --LinearLayout

When I arrive at the page, it seems to scroll to the recycler view. I just want scroll position to be at the top when arriving at the page.

Seems odd, When i switch the order between the linearlayoout and recyclerview inside the scrollview, then the behaviour is correct - as in the scroll position is at the top

like image 692
raklos Avatar asked Jun 30 '16 12:06

raklos


People also ask

What is nested scrolling in RecyclerView?

NestedScrollView is just like ScrollView, but it supports acting as both a nested scrolling parent and child. In your case you have to define your own scrolling behaviour.

Why we use nested scroll view?

NestedScrollView is used when there is a need for a scrolling view inside another scrolling view.

What is nested scroll view?

NestedScrollView is just like ScrollView , but it supports acting as both a nested scrolling parent and child on both new and old versions of Android. Nested scrolling is enabled by default.

Is recycler view scrollable?

To be able to scroll through a vertical list of items that is longer than the screen, you need to add a vertical scrollbar. Inside RecyclerView , add an android:scrollbars attribute set to vertical .


1 Answers

This worked for me:

mRecyclerView.setFocusable(false);

Although a lot of good answers here: How to scroll to top of long ScrollView layout?

like image 111
raklos Avatar answered Sep 29 '22 10:09

raklos