-1

Hi I have multiple EditText each of them having hint text.I am loading EditText views in a fragment. Whenever the fragment is loaded,cursor blinks for a fraction in the extreme left side of the edit text,but disappears after that. Even the hint is not visible. And I cannot see the typed text. However when I double click in the edit text, the entered text gets selected and the text is now visible. I am not getting what is causing this issue.

Here is my xml for EditText:

   <TableRow
            android:id="@+id/patientName_tableRow"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <TextView
                android:id="@+id/patientName"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/patient_name"
                android:textColor="@android:color/holo_blue_bright"
                android:textSize="20sp" />

            <EditText
                android:id="@+id/editText_last_name"
                android:layout_width="100dp"
                android:layout_height="wrap_content"
                android:layout_marginLeft="10dp"
                android:background="@android:color/darker_gray"
                android:hint="Last Name"
                android:inputType="text"
                android:paddingLeft="1dp"
                android:paddingRight="1dp" />

            <requestFocus />

            <EditText
                android:id="@+id/editText_first_name"
                android:layout_width="100dp"
                android:layout_height="wrap_content"
                android:layout_marginLeft="10dp"
                android:background="@android:color/darker_gray"
                android:hint="First Name"
                android:inputType="text"
                android:paddingLeft="1dp"
                android:paddingRight="1dp" />

            <requestFocus />
        </TableRow>

Please guide me.

Thanks

user2879697
  • 69
  • 1
  • 10

2 Answers2

1

Your problem is <requestFocus />. You can only use it once.

In the docs Here, it says:

Any element representing a View object can include this empty element, which gives its parent initial focus on the screen. You can have only one of these elements per file.

DevJem
  • 656
  • 1
  • 13
  • 21
0

Add this to your XML of the EditText

android:textColor="#f00"

And change to whatever color is appropriate.

bryan
  • 798
  • 7
  • 18