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.

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 start, int stop)
void setSelection(int index)
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

Public Constructors

public EditText (Context context)

public EditText (Context context, AttributeSet attrs)

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

Public Methods

public void extendSelection (int index)

public Editable getText ()

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 ()

Convenience for selectAll(Spannable).

public 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. You may also want to setSingleLine() or setHorizontallyScrolling(boolean) to constrain the text toa single line. Use null to turn off ellipsizing.

public void setSelection (int start, int stop)

public void setSelection (int index)

public 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

protected boolean getDefaultEditable ()

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 ()

Subclasses override this to specify a default movement method.