RecyclerView takes focus when inside ScrollView

Today I had to implement a fixed not scrollable recyclerview which is positioned in a ScrollView. So I had the following structure:

  • ScrollView
    •  LinearLayout
      • TextView
      • RecyclerView

And if the RecyclerView has more rows than the screen can fit it will take the focus and the TextView won’t be seen. You will directly see the stretched RecyclerView. There is a very simple fix. Just add “focusableOnTouchMode: true” to the TextView, so it won’t allow the RecyclerView to misplace is and take the focus.

focusableOnTouchMode: true

Here is the longer answer:

You may also like...