You can not see the HINT of an EditText on android

1

Good! I have an app in android studio and I can not make the HINT (default text) to be seen in the application when I run it ... it looks in android studio but in the app it does not ...

EditText XML Code:

<EditText
    android:inputType="text"
    android:ems="10"
    android:id="@+id/consultaText"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_above="@+id/notificacionText"
    android:layout_alignParentStart="true"
    android:layout_toStartOf="@+id/enviarButton"
    android:typeface="normal"
    android:textSize="18sp"
    android:textColor="@android:color/black"
    android:textAllCaps="false"
    android:hint="@string/default_text"
    android:background="@android:drawable/editbox_background"
    android:layout_alignTop="@+id/enviarButton"
    style="@android:style/Widget.EditText" />
    
asked by Matias Vidal 05.06.2017 в 04:27
source

2 answers

4

I can think of two possibilities: a) the value you have given @string/default_text is <string name="@string/default_text"></string> , that is, an empty string b) the color you gave him background android:background="@android:drawable/editbox_background" is the same color as the hint you gave him with the value of style style="@android:style/Widget.EditText" />

    
answered by 05.06.2017 в 15:54
0

If the color of the text and the background are the same color obviously the text will not be distinguishable,

 android:textColor="@android:color/black"
 android:background="@android:drawable/editbox_background"

Change the color of the text or background to a different color.

Also ensure that default_text within your file /strings.xml contains text.

android:hint="@string/default_text"
    
answered by 05.06.2017 в 19:49