-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Focus issue with EditTexts in Fragments when using ViewPager2 #107
Comments
I have also struggled with this issue! I used viewpager 1 to avoid that bug in my project. |
I have to use ViewPager2 in order to support Arabic locale as well. Is somebody looking into this issue? |
I have a similar problem when I use ViewPager2 with FragmentStateAdapter. In this situation, as a temporary solution, I can set offscreen page limit to 1. |
Experiencing the same issue moving from fragment to fragment with edittext |
Same on view holder |
I have the same issue and i have to use viewpager2 for vertical scroll which is not supported in viewpager1 |
Same issue when using edit text with fragments with viewpager2. Is there any work around? |
Increase offscreen page limit |
I have the same issue. Thanks to @FEvgenSON for the workaround, but I hope it will be fixed |
The Viewpager in the Firewall Activity is migrated from Viewpager2 to Viewpager1. There is an open focus issue in android. material-components/material-components-android#500 android/views-widgets-samples#107 UI changes for the Home screen fragment. DNS logs screen now will have the value of blocked and lifetime queries in top layout.
Unfortunately increase offscreen page limit don't work for me |
In my case the number of offscreenPageLimit should be not smaller the number of pages |
There are 3 workarounds for this issue, all worked in my case:
|
Same issue here, is there a fix available ? |
this didn't work for me |
Hey, we solved this bug in the library called Fragula. I found out that transferring the ViewPager2 code to the project and commenting out the dispatchSelected method in the ScrollEventAdapter class solves it. If you're okay with transferring the library to your app, you might use this solution to fix the bug. Here's the commit: massivemadness/Fragula@61aca39" |
|
Has ViewPager2 called the setPageTransformer() method? Please check if there are any issues with the overridden ViewPager2.PageTransformer. For example, like in the code below, does it require setVisibility(View.GONE)?private const val MAX_ROTATION = 10.0f class RotatePageTransformer : ViewPager2.PageTransformer {
} |
Build: AI-191.8026.42.35.6010548, 201911150702,
AI-191.8026.42.35.6010548, JRE 1.8.0_202-release-1483-b03x64 JetBrains s.r.o, OS Windows 10(amd64) v10.0 , screens 1536x864
AS: 3.5.3; Android Gradle Plugin: 3.5.3; Gradle: 5.4.1; NDK: from local.properties: (not specified), latest from SDK: (not found); LLDB: pinned revision 3.1 not found, latest from SDK: (package not found); CMake: from local.properties: (not specified), latest from SDK: (not found), from PATH: (not found)
I have an activity with a ViewPager2 container that swaps between three fragments. Each fragment contains two EditTexts. I have disabled manual scrolling, and the user can only traverse the fragments via a continue button. The goal is for the app to automatically focus the first EditText on the screen when the user opens that screen. The issue is that instead of the EditText getting focus, the ViewPager itself is getting the focus, even though it is not focusable. To try to fix this issue, I tried having the edittext explicitly requestFocus() in the fragment itself, but this doesn't help (after the user presses continue on the first screen, he gets to the second screen and the first edittext has no cursor or focus) and leads to some interesting scrolling issues. When I debug, I see that the ViewPager container itself has the focus.
Here is the repo, it is the ViewPager2 bug branch: https://github.com/raranov/MyExperienceNew/tree/ViewPager2
ViewPager (1) does not have this issue.
Also, I tried to do a similar thing using straight recyclerview, and that also had similar focus issues. The details are here:
https://stackoverflow.com/questions/59489756/issue-with-focus-behavior-when-using-edittexts-in-a-recyclerview
Thank you.
The text was updated successfully, but these errors were encountered: