Dieter27
Dieter27

Reputation: 114

ViewPager2 changes fragment when selecting EditText

I'm using a ViewPager2 with 3 fragments (A, B and C). Fragment A and C contain an EditText. When selecting the EditText in fragment C, the ViewPager switches back to fragment A with focus on the EditText in fragment A (keyboard opens). Can anybody explain this behaviour?

Upvotes: 4

Views: 673

Answers (1)

Vodet
Vodet

Reputation: 1519

This is a bug I have exactly the same issue, if you want to continue to use ViewPager2 you need to remove setOffscreenPageLimit(); on your viewPager, but your fragments not be retained and not being created during the viewPager implementation

Upvotes: 2

Related Questions