Description:
Put a TextInputLayoutin a ConstraintLayoutand put that into a ViewPager2via a Fragment. If the TextInputLayoutwidth is given as match_parent, it will receive focus as expected. However, if the width of the TextInputLayoutis given with 0dp and constraints, focus won't work.
Expected behavior:
Focus has to be possible no matter which way the TextInputLayoutwidth was set.
2) Touch the TextInputLayout on the second tab, the TextInputLayout will get a blue border.
Only difference between the first and second tab is that for the TextInputLayoutin the fragment of the first tab, the width is given with 0dp and constraints. On the second tab the width for the TextInputLayoutin the fragment is given as match_parent.
Description: Put a
TextInputLayout
in aConstraintLayout
and put that into aViewPager2
via a Fragment. If theTextInputLayout
width is given asmatch_parent
, it will receive focus as expected. However, if the width of theTextInputLayout
is given with 0dp and constraints, focus won't work.Expected behavior: Focus has to be possible no matter which way the
TextInputLayout
width was set.Source code: Sample at https://github.com/wondering639/viewpager2-focus-issue 1) Touch the TextInputLayout on the first tab, the TextInputLayout won't get a blue border:
2) Touch the TextInputLayout on the second tab, the TextInputLayout will get a blue border.
Only difference between the first and second tab is that for the
TextInputLayout
in the fragment of the first tab, the width is given with 0dp and constraints. On the second tab the width for theTextInputLayout
in the fragment is given as match_parent.So: fragment_first.xml (focus not working)
fragment_second.xml (focus working)
Android API version: 30, but same on API 29
Material Library version: Material Android Library version you are using here (e.g., 1.1.0-alpha07) com.google.android.material:material:1.2.1
Device: Pixel 2 / Emulator API 30