NestedScrollView scrolls to top on Recyclerview resized

The solution given by kevings14 works but it wasn't helpful in my case. I've a RecyclerView + a couple of EditText under NestedScrollView, when I added

android:descendantFocusability="blocksDescendants"

in main layout under scroll view. I was unable to focus EditText.

Then I came up with this solution, which worked for me.

<RelativeLayout
   android:layout_width="match_parent"
   android:focusable="true"
   android:focusableInTouchMode="true"
   android:layout_height="wrap_content">

After several days I've found a solution to the problem. You just need to add the descendantFocusability in the first layout under the ScrollView like this:

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/lay_account"
    android:descendantFocusability="blocksDescendants">