0

In my android app I have a text field that says "how much would you like to take".

I want the text to be erased automatically and replaced by what the user inputs when they type in that textfield.

Example: if the user enters one character it automatically deletes "how much would you like to take" from the text field and replaces it with the one character that's been entered.

Fenton
  • 224,347
  • 65
  • 373
  • 385
Ger Crowley
  • 861
  • 2
  • 10
  • 10

3 Answers3

2

In your xml file use

android:hint="how much would you like to take" 

in your TextView definition

(Well, it should be something like "@string/how_much" and that how_much string in strings.xml, but honestly...)

Alexander Kulyakhtin
  • 47,110
  • 36
  • 104
  • 156
1

Its called android:hint property of a EditText you can set it into your xml file.

Something like that.

 <EditText
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:hint="how much would you like to take" />
Akram
  • 7,510
  • 8
  • 44
  • 71
1

Try this in your xml

Use this in below code android:hint="how much would you like to take"

   <EditText
    android:id="@+id/edtName" 
    android:layout_width="fill_parent"      
    android:layout_height="wrap_content"    
    android:layout_below="@+id/txtName"     
    android:layout_marginRight="5dip" 
    android:hint="how much would you like to take" 
    android:inputType="textCapSentences"
    />

Hope it helps

vinothp
  • 9,760
  • 18
  • 59
  • 102