Questions tagged [android-edittext]

The EditText is the standard text entry widget in Android apps. If the user needs to enter text into an app, this is the primary way for them to do that.

A EditText is an overlay over TextView that configures itself to be editable. It is the predefined subclass of TextView that includes rich editing capabilities.

enter image description here

More information about the EditText:

12098 questions
4316
votes
128 answers

How to close/hide the Android soft keyboard programmatically?

I have an EditText and a Button in my layout. After writing in the edit field and clicking on the Button, I want to hide the virtual keyboard when touching outside the keyboard. I assume that this is a simple piece of code, but where can I find an…
3152
votes
54 answers

How to stop EditText from gaining focus when an activity starts in Android?

I have an Activity in Android, with two elements: EditText ListView When my Activity starts, the EditText immediately has the input focus (flashing cursor). I don't want any control to have input focus at startup. I…
Mark
  • 39,551
  • 15
  • 41
  • 47
1058
votes
27 answers

Place cursor at the end of text in EditText

I am changing the value of an EditText on keyListener. But when I change the text the cursor is moving to the beginning of the EditText. I need the cursor to be at the end of the text. How to move the cursor to the end of the text in a EditText.
Manu
  • 10,589
  • 3
  • 15
  • 3
838
votes
22 answers

What's the best way to limit text length of EditText in Android

What's the best way to limit the text length of an EditText in Android? Is there a way to do this via xml?
hpique
  • 119,096
  • 131
  • 338
  • 476
619
votes
28 answers

Set EditText cursor color

I am having this issue where I am using the Android's Holo theme on a tablet project. However, I have a fragment on screen which has a white background. I am adding an EditText component on this fragment. I've tried to override the theme by setting…
dineth
  • 9,822
  • 6
  • 32
  • 39
607
votes
30 answers

How to hide underbar in EditText

How can I hide the EditText underbar (the prompt line with little serifs at the ends)? There might be a better way to do what I want: I have a layout with an EditText. Normally, this displays fine where the user can tap on it and begin entering or…
Peri Hartman
  • 19,314
  • 18
  • 55
  • 101
581
votes
15 answers

Allow multi-line in EditText view in Android?

How to allow multi-line in Android's EditText view?
Adham
  • 63,550
  • 98
  • 229
  • 344
542
votes
48 answers

How to show soft-keyboard when edittext is focused

I want to automatically show the soft-keyboard when an EditText is focused (if the device does not have a physical keyboard) and I have two problems: When my Activity is displayed, my EditText is focused but the keyboard is not displayed, I need to…
Ludovic Landry
  • 11,606
  • 10
  • 48
  • 80
530
votes
33 answers

Android - Handle "Enter" in an EditText

I am wondering if there is a way to handle the user pressing Enter while typing in an EditText, something like the onSubmit HTML event. Also wondering if there is a way to manipulate the virtual keyboard in such a way that the "Done" button is…
Felix
  • 88,392
  • 43
  • 149
  • 167
480
votes
13 answers

Get Value of a Edit Text field

I am learning how to create UI elements. I have created a few EditText input fields. On the click of a Button I want to capture the content typed into that input field. That's my field. How…
Harsha M V
  • 54,075
  • 125
  • 354
  • 529
429
votes
18 answers

Android: Force EditText to remove focus?

I would like to be able to remove the focus from the EditText. For example if the Keyboard appears, and the user hides it with the back button, I would like the focus and the cursor to disappear. How can it be done?
Alex1987
  • 9,397
  • 14
  • 70
  • 92
427
votes
17 answers

First letter capitalization for EditText

I'm working on a little personal todo list app and so far everything has been working quite well. There is one little quirk I'd like to figure out. Whenever I go to add a new item, I have a Dialog with an EditText view showing inside. When I select…
Maximus
  • 8,351
  • 3
  • 29
  • 37
375
votes
33 answers

Android: show soft keyboard automatically when focus is on an EditText

I'm showing an input box using AlertDialog. The EditText inside the dialog itself is automatically focused when I call AlertDialog.show(), but the soft keyboard is not automatically shown. How do I make the soft keyboard automatically show when the…
Randy Sugianto 'Yuku'
  • 71,383
  • 57
  • 178
  • 228
362
votes
26 answers

restrict edittext to single line

possible duplicate : android-singleline-true-not-working-for-edittext
Pankaj Singhal
  • 15,283
  • 9
  • 47
  • 86
326
votes
25 answers

Changing EditText bottom line color with appcompat v7

I am using appcompat v7 to get the look consistent on Android 5 and less. It works rather well. However I cannot figure out how to change the bottom line color and the accent color for EditTexts. Is it possible? I have tried to define a custom…
Laurent
  • 14,122
  • 13
  • 57
  • 89
1
2 3
99 100