4

I am trying to achieve a log-in screen like the following:enter image description here

Where the field's name is displayed in the field itself. I am using the ADT plugin in Eclipse. I tried setting the android:text attribute of the text input, but I don't think this is correct because through the password field, only the dots show (the redacted text), and not the text itself. What is the attribute then. I have looked in the documentation for the EditText widget.

The XML I currently have for the two EditText fields are:

    <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>
Gus
  • 4,375
  • 5
  • 31
  • 50

2 Answers2

8

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

android:hint="Please enter your password"

its the first one, thanks to a search on SO. Just for additional info it came up with this.

SO Question about android:hint

Community
  • 1
  • 1
sealz
  • 5,348
  • 5
  • 40
  • 70
0

Share Java code for when click on Submit Button then Show the 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"
        />
Jose Da Silva Gomes
  • 3,814
  • 3
  • 24
  • 34
Tarsbir Singh
  • 527
  • 5
  • 11