Android text input - field name shown in the field itself

I am trying to create a login screen as shown below: enter image description here

If the field name is displayed in the field itself. I am using the ADT plugin in Eclipse. I tried to set the android:text attribute for android:text input, but I don’t think it’s right, because only dots (edited text) are displayed in the password field, not the text itself. Then what attribute. I looked at the documentation for the EditText widget .

Currently XML for two EditText fields:

  <EditText android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/editText1" android:inputType="textEmailAddress" android:text="@string/username"> <requestFocus></requestFocus> </EditText> <EditText android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/editText2" android:inputType="textPassword" android:text="@string/password" ></EditText> 
+4
source share
2 answers

You should be able to set default values ​​for fields with android:hint or android:sethint I think this is the first.

 android:hint="Please enter your password" 

his first, thanks to a search on SO. Just for additional information it came up.

SO Question about android: tooltip

+8
source

Share the Java code when you click Submit, then Show Name

 <EditText android:id="@+id/name_enter" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="@string/Name" android:inputType="textCapSentences|textAutoCorrect" /> 
0
source

All Articles