public class

EditText

extends TextView
java.lang.Object
   ↳ android.view.View
     ↳ android.widget.TextView
       ↳ android.widget.EditText
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

EditText is a thin veneer over TextView that configures itself to be editable.

See the Form Stuff tutorial.

XML attributes

See EditText Attributes, TextView Attributes, View Attributes

Summary

[Expand]
Inherited XML Attributes
From class android.widget.TextView
From class android.view.View
[Expand]
Inherited Constants
From class android.view.View
Public Constructors
EditText(Context context)
EditText(Context context, AttributeSet attrs)
EditText(Context context, AttributeSet attrs, int defStyle)
Public Methods
void extendSelection(int index)
Editable getText()
Return the text the TextView is displaying.
void selectAll()
Convenience for selectAll(Spannable).
void setEllipsize(TextUtils.TruncateAt ellipsis)
Causes words in the text that are longer than the view is wide to be ellipsized instead of broken in the middle.
void setSelection(int index)
void setSelection(int start, int stop)
void setText(CharSequence text, TextView.BufferType type)
Sets the text that this TextView is to display (see setText(CharSequence)) and also sets whether it is stored in a styleable/spannable buffer and whether it is editable.
Protected Methods
boolean getDefaultEditable()
Subclasses override this to specify that they have a KeyListener by default even if not specifically called for in the XML options.
MovementMethod getDefaultMovementMethod()
Subclasses override this to specify a default movement method.
[Expand]
Inherited Methods
From class android.widget.TextView
From class android.view.View
From class java.lang.Object
From interface android.graphics.drawable.Drawable.Callback
From interface android.view.KeyEvent.Callback
From interface android.view.ViewTreeObserver.OnPreDrawListener
From interface android.view.accessibility.AccessibilityEventSource

Public Constructors

public EditText (Context context)

Since: API Level 1

public EditText (Context context, AttributeSet attrs)

Since: API Level 1

public EditText (Context context, AttributeSet attrs, int defStyle)

Since: API Level 1

Public Methods

public void extendSelection (int index)

Since: API Level 1

public Editable getText ()

Since: API Level 1

Return the text the TextView is displaying. If setText() was called with an argument of BufferType.SPANNABLE or BufferType.EDITABLE, you can cast the return value from this method to Spannable or Editable, respectively. Note: The content of the return value should not be modified. If you want a modifiable one, you should make your own copy first.

public void selectAll ()

Since: API Level 1

Convenience for selectAll(Spannable).

public void setEllipsize (TextUtils.TruncateAt ellipsis)

Since: API Level 1

Causes words in the text that are longer than the view is wide to be ellipsized instead of broken in the middle. You may also want to setSingleLine() or setHorizontallyScrolling(boolean) to constrain the text to a single line. Use null to turn off ellipsizing.

public void setSelection (int index)

Since: API Level 1

public void setSelection (int start, int stop)

Since: API Level 1

public void setText (CharSequence text, TextView.BufferType type)

Since: API Level 1

Sets the text that this TextView is to display (see setText(CharSequence)) and also sets whether it is stored in a styleable/spannable buffer and whether it is editable.

Protected Methods

protected boolean getDefaultEditable ()

Since: API Level 1

Subclasses override this to specify that they have a KeyListener by default even if not specifically called for in the XML options.

protected MovementMethod getDefaultMovementMethod ()

Since: API Level 1

Subclasses override this to specify a default movement method.