1

I have a recycler view with 2 view types, 1 is just a textview another is just an edittext. The edittext is always at the bottom of the recycler view below the text. When I am typing in the edittext and scroll up, the edittext is recycled but is it possible to keep it from being recycled and allow users to keep typing after scrolling up?

Rgfvfk Iff
  • 1,549
  • 2
  • 23
  • 47

2 Answers2

1

If you need to disable view recycling (and you understand the tradeoffs), you are better off using a LinearLayout and adding views at runtime to it.

Udit
  • 1,037
  • 6
  • 11
1

If you want to user recycler view and also want to retain entered text, you have to use TextWatcher(https://developer.android.com/reference/android/text/TextWatcher) and need to save changed text in your collection object.

editTextInstance.addTextChangedListener(new TextWatcher() {

   @Override
   public void afterTextChanged(Editable s) {}

   @Override    
   public void beforeTextChanged(CharSequence s, int start,
     int count, int after) {
   }

   @Override    
   public void onTextChanged(CharSequence s, int start,
     int before, int count) {
             collcectionInstance.get(position).setName(s);
   }
  });
Karan Rana
  • 638
  • 4
  • 14