FileDocCategorySizeDatePackage
EditText.javaAPI DocAndroid 5.1 API4809Thu Mar 12 22:22:10 GMT 2015android.widget

EditText

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

See the Text Fields guide.

XML attributes

See {@link android.R.styleable#EditText EditText Attributes}, {@link android.R.styleable#TextView TextView Attributes}, {@link android.R.styleable#View View Attributes}

Fields Summary
Constructors Summary
public EditText(android.content.Context context)

        this(context, null);
    
public EditText(android.content.Context context, android.util.AttributeSet attrs)

        this(context, attrs, com.android.internal.R.attr.editTextStyle);
    
public EditText(android.content.Context context, android.util.AttributeSet attrs, int defStyleAttr)

        this(context, attrs, defStyleAttr, 0);
    
public EditText(android.content.Context context, android.util.AttributeSet attrs, int defStyleAttr, int defStyleRes)

        super(context, attrs, defStyleAttr, defStyleRes);
    
Methods Summary
public voidextendSelection(int index)
Convenience for {@link Selection#extendSelection}.

        Selection.extendSelection(getText(), index);
    
protected booleangetDefaultEditable()

        return true;
    
protected android.text.method.MovementMethodgetDefaultMovementMethod()

        return ArrowKeyMovementMethod.getInstance();
    
public android.text.EditablegetText()

        return (Editable) super.getText();
    
public voidonInitializeAccessibilityEvent(android.view.accessibility.AccessibilityEvent event)

        super.onInitializeAccessibilityEvent(event);
        event.setClassName(EditText.class.getName());
    
public voidonInitializeAccessibilityNodeInfo(android.view.accessibility.AccessibilityNodeInfo info)

        super.onInitializeAccessibilityNodeInfo(info);
        info.setClassName(EditText.class.getName());
    
public booleanperformAccessibilityAction(int action, android.os.Bundle arguments)

        switch (action) {
            case AccessibilityNodeInfo.ACTION_SET_TEXT: {
                CharSequence text = (arguments != null) ? arguments.getCharSequence(
                        AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE) : null;
                setText(text);
                if (text != null && text.length() > 0) {
                    setSelection(text.length());
                }
                return true;
            }
            default: {
                return super.performAccessibilityAction(action, arguments);
            }
        }
    
public voidselectAll()
Convenience for {@link Selection#selectAll}.

        Selection.selectAll(getText());
    
public voidsetEllipsize(TextUtils.TruncateAt ellipsis)

        if (ellipsis == TextUtils.TruncateAt.MARQUEE) {
            throw new IllegalArgumentException("EditText cannot use the ellipsize mode "
                    + "TextUtils.TruncateAt.MARQUEE");
        }
        super.setEllipsize(ellipsis);
    
public voidsetSelection(int index)
Convenience for {@link Selection#setSelection(Spannable, int)}.

        Selection.setSelection(getText(), index);
    
public voidsetSelection(int start, int stop)
Convenience for {@link Selection#setSelection(Spannable, int, int)}.

        Selection.setSelection(getText(), start, stop);
    
public voidsetText(java.lang.CharSequence text, BufferType type)

        super.setText(text, BufferType.EDITABLE);