EditTextpublic 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} |
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 void | extendSelection(int index)Convenience for {@link Selection#extendSelection}.
Selection.extendSelection(getText(), index);
| protected boolean | getDefaultEditable()
return true;
| protected android.text.method.MovementMethod | getDefaultMovementMethod()
return ArrowKeyMovementMethod.getInstance();
| public android.text.Editable | getText()
return (Editable) super.getText();
| public void | onInitializeAccessibilityEvent(android.view.accessibility.AccessibilityEvent event)
super.onInitializeAccessibilityEvent(event);
event.setClassName(EditText.class.getName());
| public void | onInitializeAccessibilityNodeInfo(android.view.accessibility.AccessibilityNodeInfo info)
super.onInitializeAccessibilityNodeInfo(info);
info.setClassName(EditText.class.getName());
| public boolean | performAccessibilityAction(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 void | selectAll()Convenience for {@link Selection#selectAll}.
Selection.selectAll(getText());
| public void | setEllipsize(TextUtils.TruncateAt ellipsis)
if (ellipsis == TextUtils.TruncateAt.MARQUEE) {
throw new IllegalArgumentException("EditText cannot use the ellipsize mode "
+ "TextUtils.TruncateAt.MARQUEE");
}
super.setEllipsize(ellipsis);
| public void | setSelection(int index)Convenience for {@link Selection#setSelection(Spannable, int)}.
Selection.setSelection(getText(), index);
| public void | setSelection(int start, int stop)Convenience for {@link Selection#setSelection(Spannable, int, int)}.
Selection.setSelection(getText(), start, stop);
| public void | setText(java.lang.CharSequence text, BufferType type)
super.setText(text, BufferType.EDITABLE);
|
|