3

I have a vertical RecyclerView where each cell has a horizontal RecyclerView. Each cell in the horizontal RecyclerView has an EditText. When an EditText receives focus in the click event the scroll moves to the last cell.

Has anyone ever had this experience and knows a solution to this problem?

EditText:

<EditText
    android:id="@+id/item_grade_et_quantidade"
    android:layout_width="60dp"
    android:layout_height="wrap_content"
    android:gravity="center"
    android:inputType="number"
    android:imeOptions="actionDone"
    android:selectAllOnFocus="true"
    android:text="0"/>

horizontal RecyclerView XML:

<android.support.v7.widget.RecyclerView
     android:id="@+id/rv_list_produto_childs"
     android:scrollbars="horizontal"
     android:layout_width="match_parent"
     android:fadeScrollbars="false"
     android:layout_height="185dp" />

horizontal RecyclerView Java:

rvProdutoChilds.setHasFixedSize(true);
LinearLayoutManager mLinearLayoutManager = new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false);
rvProdutoChilds.setLayoutManager(mLinearLayoutManager);

Example of problem:

enter image description here

Lucas B.
  • 489
  • 5
  • 15
  • add a few more horizontal cells and test if it is really scrolling to the end - or just to the left-most-ish position of the edittext – TWL Jan 25 '17 at 01:36
  • similar issue http://stackoverflow.com/questions/35131195/forbid-scroll-recyclerview-if-focus-edittext – TWL Jan 25 '17 at 01:39
  • @twl I tested with more cells. The scroll moves to the end. – Lucas B. Jan 25 '17 at 11:26
  • Just like [my problem](https://stackoverflow.com/questions/64802989/keep-state-recyclerview-when-keyboard-open), have you found a solution? – Aldan Nov 24 '20 at 07:03

2 Answers2

0

If the number of effort texts in each cell of the vertical recycler view our fixed, you should try using a horizontal scroll view instead of a horizontal recycler view.

Abhriya Roy
  • 1,338
  • 17
  • 23
0

Try putting the attribute android:focusableInTouchMode="false" in your EditText parent layout.

Nico
  • 993
  • 6
  • 7