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
  • 241,084
  • 71
  • 387
  • 401
Ger Crowley
  • 901
  • 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,782
  • 38
  • 107
  • 158
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,548
  • 8
  • 45
  • 72
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,939
  • 19
  • 61
  • 103