2

I seem to have quite a specific problem. I have two tablets, one runs on Android 6.0.1, the other on 5.1.1. I have an activity and a fragment (the fragment is located on an activity). Each has an EditText element with the following layout:

 <EditText
        android:id="@+id/etInputForm_1_1"
        android:layout_width="250dp"
        android:layout_height="30dp"
        android:layout_below="@id/tvDescription_1"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="20dp"
        android:cursorVisible="true"
        android:imeOptions="actionNext"
        android:paddingBottom="5dp"
        android:paddingLeft="5dp"
        android:paddingStart="5dp"
        android:textColor="@color/Black"
        android:textSize="15sp"/>

The problem is, if I test it on the device with Android 6.0.1, everything seems to be ok, I can input text wherever I want to, however on the device with 5.1.1, the EditText in the fragment always seems to be empty no matter how many letters I type (the EditText in the activity still works fine).

But the logs still show that the text IS there (however we can't see it). Anyone had similar problem and a solution to this?

SpKiwi
  • 202
  • 3
  • 12
  • do you use the same background color? – Luca Nicoletti Apr 27 '17 at 15:13
  • try android:textColorHint="#000000". Its a "bug" even if you dont use hints. It may help. Try android:ellipsize="end" aswell (http://stackoverflow.com/questions/3608234/edittext-hint-doesnt-show). Anyway, in your case it seems to be another issue. Please post the parent Layout aswell – Emanuel Apr 27 '17 at 15:14
  • The background color is another. This problem exists on android 5.1.1, on the higher versions it seems to work fine. – SpKiwi Apr 27 '17 at 15:21
  • Switching textColorHelp not helping either and so is ellipsize. The parent layout is just as simple as this: – SpKiwi Apr 27 '17 at 15:24

3 Answers3

7

I had a similar issue where the edit text hint wouldn't go away (representing text was in the field) and no text would show up when I was typing but my logs showed text was indeed in the field. I also had an issue where my spinners would not show the selected option

I solved it by enabling hardware acceleration for my application. Since it is enabled by default (I believe) I removed this line from my <application></application> section of my manifest file: android:hardwareAccelerated="false"

Justin Brown
  • 71
  • 1
  • 4
0

My issue resolved after removing following line from edit text.

android:textAllCaps="true"
Mazhar Ali
  • 111
  • 2
  • 6
-1

The problem was resolved by using android.app.Fragment instead of android.support.v4.app.Fragment. Seems that the support fragment class is buggy when using on tablets with Android 5.1.1.

SpKiwi
  • 202
  • 3
  • 12