In my Android application I have an EditText which is sat inside a LinearLayout. This page is used in a ViewPager.
On majority of the devices I have tested on, it seems that the EditText behaves perfectly fine, except on a few.
It appears that on a few devices, when I touch the EditText and start typing, the text doesn't show but the suggestions do show. It is only after the Keyboard is closed that the text appears within the EditText.
Why is this the case? Why does the text not show whilst I type? Why does it show only after I close the keyboard?
Code:
<RadioGroup
android:id="@+id/searchGroup"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp">
...
...
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="textCapWords|textPostalAddress"
android:id="@+id/searchText"
android:hint="@string/locationHint"
android:imeOptions="actionDone"
android:layout_below="@+id/locationGroup"
android:layout_margin="10dp"
android:singleLine="true"/>
...
...
</LinearLayout>
Update
The EditText works fine if it's outside of the ViewPager`. It's only inside the ViewPager that it misbehaves.
Having come across this issue at work with a number of devices and pulling my hair out (which I am sure you can appreciate) I found that wrapping the edittext view in a scrollview resolves the problem. The properties of the scrollview can be set so as not to affect the layout of your view.
Bounty me boy.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With