title: Android. Nested recyclerview scrolling itself when traverse through parent recycler
body: <p><strong>Update:</strong>
   I decide to create a github repo with this issue to anyone can try to reproduce it and try to fix it.
   <a href="https://github.com/LolusKekus/NestsedRecyclerScrollItselfChallenge" rel="nofollow noreferrer">https://github.com/LolusKekus/NestsedRecyclerScrollItselfChallenge</a></p>
  
  <hr>
  
  <p><strong>Update2</strong>
  Spending some time in research i'm finally find a solution thats feet my demands.</p>
  
  <p>All i need is <strong>extend recyclerview</strong> class and <strong>override forcusSearch</strong> method as follo:</p>
  
  <pre><code>    @Override
      public View focusSearch(View focused, int direction) {
          View view = super.focusSearch(focused, direction);
          Log.d(TAG, "focusSearch: ");
          if (view instanceof CRecyclerView) {
              int position = ((LinearLayoutManager)((CRecyclerView) view).getLayoutManager()).findFirstVisibleItemPosition();
              view = ((CRecyclerView) view).getLayoutManager().findViewByPosition(position);
          }
  
          return view;
      }
  </code></pre>
  
  <p>CRecyclerView - my extended RecyclerView.</p>
  
  <p>In normal conditions focusSearch returns my itemview and everything is fine. But for some reasons focusSearch return RecyclerView instance and as result i have this annoying auto scroll. I don't dig deeper in this problem cause i've got all i need. But if someone can, I'll be appreciate.</p>
  
  <hr>
  
  <p>I have vertical recycler with a bunch of nested horisontal recyclers.
  When i'm scrolling over vertical recycler, nested recyclers scroll themself without any reason.</p>
  
  <p>It's looks like this.
  Before scroll, let's imagine that selector on 31:</p>
  
  <pre><code>_____________
  |31 32 33 34|
  |41 42 43 44|
  |51 52 53 54|
  _____________
  </code></pre>
  
  <p>now press up on dpad (i'm working on android tv app):</p>
  
  <pre><code>_____________
  |24 25 26 27|
  |31 32 33 34|
  |41 42 43 44|
  _____________
  </code></pre>
  
  <p>Hidden recyclerview appears, binds and scrolls up to 24 element. But it mustn't be! The selected item must be 21! And so on until the top of vertical recycler... 14... 04...</p>
  
  <p>I'm noticed, nested recycler scrolls just to last visible item on it.</p>
  
  <p>this behavior appears after <strong>"com.android.support:recyclerview-v7:24.2.1"</strong></p>
  
  <p>Now i'm using <strong>"com.android.support:recyclerview-v7:27.1.1"</strong> and faced with this issue.</p>
  
  <p>Activity:</p>
  
  <pre><code>public class MainActivity extends AppCompatActivity {
      List&lt;String&gt; hDataset;
      List&lt;Integer&gt; vDataset;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          context = this;
          hDataset = new ArrayList&lt;&gt;();
          for (int i=0; i&lt;hItemsCount; i++) {
              hDataset.add(String.format("lolKek Cheburek %d", i));
          }
  
          vDataset = new ArrayList&lt;&gt;();
          for (int i=0; i&lt;vItemsCount; i++) {
              vDataset.add(i);
          }
  
          vRecyclerView = findViewById(R.id.vRecyclerView);
          vRecyclerView.setHasFixedSize(true);
  
          LinearLayoutManager layoutManager = new LinearLayoutManager(this);
          layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
          vRecyclerView.setLayoutManager(layoutManager);
          vRecyclerView.setAdapter(new VAdapter(vDataset, hDataset, context));
  }
  </code></pre>
  
  <p>Vertical adapter:</p>
  
  <pre><code>public class VAdapter extends RecyclerView.Adapter&lt;VAdapter.MyVertHolder&gt;() {
      private List&lt;String&gt; hDataset;
      private Context context;
  
      public VAdapter(List&lt;String&gt; hDataset, List&lt;String&gt; vDataset, Context context) {
         this.hDataset = hDataset;
         this.vDataset = vDataset;
         this.context = context;
      }
  
      public static class MyVertHolder extends RecyclerView.ViewHolder {
          RecyclerView hRecyclerView;
  
          public MyVertHolder(final View itemView) {
              super(itemView);
              hRecyclerView = itemView.findViewById(R.id.hRecyclerView);
          }
  
          public void setAdapter(HAdapter adapter) {
              hRecyclerView.setAdapter(adapter);
          }
  
          public void setLayoutManager(LinearLayoutManager layoutManager) {
              hRecyclerView.setLayoutManager(layoutManager);
          }
      }
  
      @NonNull
      @Override
      public MyVertHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
          View itemView = LayoutInflater
              .from(parent.getContext())
              .inflate(R.layout.v_item_view, parent, false);
  
          MyVertHolder holder = new MyVertHolder(itemView);
          holder.setAdapter(new HAdapter(hDataset));
          holder.setLayoutManager(new LinearLayoutManage(context, LinearLayoutManager.HORIZONTAL, false));
          return holder;
      }
  
      @Override
      public void onBindViewHolder(final @NonNull MyVertHolder holder, int position) {
          ... some bindings
      }
  }
  
  </code></pre>
  
  <p>Horisontal adapter:</p>
  
  <pre><code>class HAdapter extends RecyclerView.Adapter&lt;HAdapter.MyHolder&gt; {
      private List&lt;String&gt; dataset;
      public HAdapter(List&lt;String&gt; dataset) {
          this.dataset = dataset;
      }
  
      public static class MyHolder extends RecyclerView.ViewHolder {
  
          private TextView tvItemText;
  
          public MyHolder(FrameLayout itemView) {
              super(itemView);
              tvItemText = itemView.findViewById(R.id.tvItemText);
          }
      }
  
  @Override
      public MyHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
          FrameLayout itemView = (FrameLayout) LayoutInflater
  .from(parent.getContext()).inflate(R.layout.item_view, parent, false);
          return new MyHolder(itemView);
      }
  
      @Override
      public void onBindViewHolder(final @NonNull MyHolder holder, final int position) {
          holder.setItemText(dataset.get(position));
  }
  
  </code></pre>
  
  <p>main activity layout:</p>
  
  <pre><code>
  &lt;FrameLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      tools:context="MainActivity"&gt;
          &lt;android.support.v7.widget.RecyclerView
              android:id="@+id/vRecyclerView"
              android:orientation="vertical"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"/&gt;
  &lt;/FrameLayout&gt;
  </code></pre>
  
  <p>vertical item view layout:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  &lt;android.support.v7.widget.RecyclerView
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:background="@color/colorAccent"
      android:id="@+id/hRecyclerView"
      android:focusableInTouchMode="true"
      android:focusable="true"
      android:orientation="horizontal"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"/&gt;
  </code></pre>
  
  <p>horisontal item view layout:</p>
  
  <pre><code>&lt;FrameLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/flContainer"
      android:layout_margin="5dp"
      android:focusable="true"
      android:layout_width="250dp"
      android:layout_height="150dp"&gt;
  
      &lt;TextView
          android:id="@+id/tvItemText"
          android:textColor="@color/white"
          android:layout_gravity="center"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content" /&gt;
  &lt;/FrameLayout&gt;
  </code></pre>
  
  <p>I want stop this annoying auto scroll behavior.
  Thanks.</p>