java.lang.Object | ||
↳ | android.view.View | |
↳ | android.widget.TextView |
Known Direct Subclasses |
Known Indirect Subclasses |
Displays text to the user and optionally allows them to edit it. A TextView is a complete text editor, however the basic class is configured to not allow editing; see EditText for a subclass that configures the text view for editing.
XML attributes
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
TextView.BufferType | |||||||||||
TextView.OnEditorActionListener | Interface definition for a callback to be invoked when an action is performed on the editor. | ||||||||||
TextView.SavedState | User interface state that is stored by TextView for implementing onSaveInstanceState(). |
XML Attributes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
android:autoLink | setAutoLinkMask(int) | Controls whether links such as urls and email addresses are automatically found and converted to clickable links. | |||||||||
android:autoText | setKeyListener(KeyListener) | If set, specifies that this TextView has a textual input method and automatically corrects some common spelling errors. | |||||||||
android:bufferType | setText(CharSequence,TextView.BufferType) | Determines the minimum type that getText() will return. | |||||||||
android:capitalize | setKeyListener(KeyListener) | If set, specifies that this TextView has a textual input method and should automatically capitalize what the user types. | |||||||||
android:cursorVisible | setCursorVisible(boolean) | Makes the cursor visible (the default) or invisible
Must be a boolean value, either " |
|||||||||
android:digits | setKeyListener(KeyListener) | If set, specifies that this TextView has a numeric input method and that these specific characters are the ones that it will accept. | |||||||||
android:drawableBottom | setCompoundDrawablesWithIntrinsicBounds(Drawable,Drawable,Drawable,Drawable) | The drawable to be drawn below the text. | |||||||||
android:drawableLeft | setCompoundDrawablesWithIntrinsicBounds(Drawable,Drawable,Drawable,Drawable) | The drawable to be drawn to the left of the text. | |||||||||
android:drawablePadding | setCompoundDrawablePadding(int) | The padding between the drawables and the text. | |||||||||
android:drawableRight | setCompoundDrawablesWithIntrinsicBounds(Drawable,Drawable,Drawable,Drawable) | The drawable to be drawn to the right of the text. | |||||||||
android:drawableTop | setCompoundDrawablesWithIntrinsicBounds(Drawable,Drawable,Drawable,Drawable) | The drawable to be drawn above the text. | |||||||||
android:editable | If set, specifies that this TextView has an input method. | ||||||||||
android:editorExtras | setInputExtras(int) | Reference to an <input-extras> XML resource containing additional data to supply to an input method, which is private to the implementation of the input method. | |||||||||
android:ellipsize | setEllipsize(TextUtils.TruncateAt) | If set, causes words that are longer than the view is wide to be ellipsized instead of broken in the middle. | |||||||||
android:ems | setEms(int) | Makes the TextView be exactly this many ems wide
Must be an integer value, such as " |
|||||||||
android:freezesText | setFreezesText(boolean) | If set, the text view will include its current complete text inside of its frozen icicle in addition to meta-data such as the current cursor position. | |||||||||
android:gravity | setGravity(int) | Specifies how to align the text by the view's x and/or y axis when the text is smaller than the view. | |||||||||
android:height | setHeight(int) | Makes the TextView be exactly this many pixels tall. | |||||||||
android:hint | setHint(int) | Hint text to display when the text is empty. | |||||||||
android:imeActionId | setImeActionLabel(CharSequence,int) | Supply a value for EditorInfo.actionId used when an input method is connected to the text view. | |||||||||
android:imeActionLabel | setImeActionLabel(CharSequence,int) | Supply a value for EditorInfo.actionLabel used when an input method is connected to the text view. | |||||||||
android:imeOptions | setImeOptions(int) | Additional features you can enable in an IME associated with an editor, to improve the integration with your application. | |||||||||
android:includeFontPadding | setIncludeFontPadding(boolean) | Leave enough room for ascenders and descenders instead of using the font ascent and descent strictly. | |||||||||
android:inputMethod | setKeyListener(KeyListener) | If set, specifies that this TextView should use the specified input method (specified by fully-qualified class name). | |||||||||
android:inputType | setRawInputType(int) | The type of data being placed in a text field, used to help an input method decide how to let the user enter text. | |||||||||
android:lineSpacingExtra | setLineSpacing(float,float) | Extra spacing between lines of text. | |||||||||
android:lineSpacingMultiplier | setLineSpacing(float,float) | Extra spacing between lines of text, as a multiplier. | |||||||||
android:lines | setLines(int) | Makes the TextView be exactly this many lines tall
Must be an integer value, such as " |
|||||||||
android:linksClickable | setLinksClickable(boolean) | If set to false, keeps the movement method from being set to the link movement method even if autoLink causes links to be found. | |||||||||
android:marqueeRepeatLimit | setMarqueeRepeatLimit(int) | The number of times to repeat the marquee animation. | |||||||||
android:maxEms | setMaxEms(int) | Makes the TextView be at most this many ems wide
Must be an integer value, such as " |
|||||||||
android:maxHeight | setMaxHeight(int) | Makes the TextView be at most this many pixels tall
Must be a dimension value, which is a floating point number appended with a unit such as " |
|||||||||
android:maxLength | setFilters(InputFilter) | Set an input filter to constrain the text length to the specified number. | |||||||||
android:maxLines | setMaxLines(int) | Makes the TextView be at most this many lines tall
Must be an integer value, such as " |
|||||||||
android:maxWidth | setMaxWidth(int) | Makes the TextView be at most this many pixels wide
Must be a dimension value, which is a floating point number appended with a unit such as " |
|||||||||
android:minEms | setMinEms(int) | Makes the TextView be at least this many ems wide
Must be an integer value, such as " |
|||||||||
android:minHeight | setMinHeight(int) | Makes the TextView be at least this many pixels tall
Must be a dimension value, which is a floating point number appended with a unit such as " |
|||||||||
android:minLines | setMinLines(int) | Makes the TextView be at least this many lines tall
Must be an integer value, such as " |
|||||||||
android:minWidth | setMinWidth(int) | Makes the TextView be at least this many pixels wide
Must be a dimension value, which is a floating point number appended with a unit such as " |
|||||||||
android:numeric | setKeyListener(KeyListener) | If set, specifies that this TextView has a numeric input method. | |||||||||
android:password | setTransformationMethod(TransformationMethod) | Whether the characters of the field are displayed as password dots instead of themselves. | |||||||||
android:phoneNumber | setKeyListener(KeyListener) | If set, specifies that this TextView has a phone number input method. | |||||||||
android:privateImeOptions | setPrivateImeOptions(String) | An addition content type description to supply to the input method attached to the text view, which is private to the implementation of the input method. | |||||||||
android:scrollHorizontally | setHorizontallyScrolling(boolean) | Whether the text is allowed to be wider than the view (and therefore can be scrolled horizontally). | |||||||||
android:selectAllOnFocus | setSelectAllOnFocus(boolean) | If the text is selectable, select it all when the view takes focus instead of moving the cursor to the start or end. | |||||||||
android:shadowColor | setShadowLayer(float,float,float,int) | Place a shadow of the specified color behind the text. | |||||||||
android:shadowDx | setShadowLayer(float,float,float,int) | Horizontal offset of the shadow. | |||||||||
android:shadowDy | setShadowLayer(float,float,float,int) | Vertical offset of the shadow. | |||||||||
android:shadowRadius | setShadowLayer(float,float,float,int) | Radius of the shadow. | |||||||||
android:singleLine | setTransformationMethod(TransformationMethod) | Constrains the text to a single horizontally scrolling line instead of letting it wrap onto multiple lines, and advances focus instead of inserting a newline when you press the enter key. | |||||||||
android:text | setText(CharSequence) | Text to display. | |||||||||
android:textColor | setTextColor(ColorStateList) | Text color. | |||||||||
android:textColorHighlight | setHighlightColor(int) | Color of the text selection highlight. | |||||||||
android:textColorHint | setHintTextColor(int) | Color of the hint text. | |||||||||
android:textColorLink | setLinkTextColor(int) | Text color for links. | |||||||||
android:textScaleX | setTextScaleX(float) | Sets the horizontal scaling factor for the text
Must be a floating point value, such as " |
|||||||||
android:textSize | setTextSize(float) | Size of the text. | |||||||||
android:textStyle | setTypeface(Typeface) | Style (bold, italic, bolditalic) for the text. | |||||||||
android:typeface | setTypeface(Typeface) | Typeface (normal, sans, serif, monospace) for the text. | |||||||||
android:width | setWidth(int) | Makes the TextView be exactly this many pixels wide. |
[Expand]
Inherited XML Attributes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.view.View
|
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.view.View
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Adds a TextWatcher to the list of those whose methods are called
whenever this TextView's text changes.
| |||||||||||
Convenience method: Append the specified text to the TextView's
display buffer, upgrading it to BufferType.EDITABLE if it was
not already editable.
| |||||||||||
Convenience method: Append the specified text slice to the TextView's
display buffer, upgrading it to BufferType.EDITABLE if it was
not already editable.
| |||||||||||
Move the point, specified by the offset, into the view if it is needed.
| |||||||||||
Cancels a pending long press.
| |||||||||||
Use BaseInputConnection.removeComposingSpans() to remove any IME composing
state from this text view.
| |||||||||||
Called by a parent to request that a child update its values for mScrollX
and mScrollY if necessary.
| |||||||||||
Prints information about this view in the log output, with the tag
VIEW_LOG_TAG.
| |||||||||||
Returns true, only while processing a touch gesture, if the initial
touch down event caused focus to move to the text view and as a result
its selection changed.
| |||||||||||
If this TextView contains editable content, extract a portion of it
based on the information in request in to outText.
| |||||||||||
Gets the autolink mask of the text.
| |||||||||||
Return the offset of the widget's text baseline from the widget's top boundary. | |||||||||||
Returns the padding between the compound drawables and the text.
| |||||||||||
Returns drawables for the left, top, right, and bottom borders.
| |||||||||||
Returns the bottom padding of the view, plus space for the bottom
Drawable if any.
| |||||||||||
Returns the left padding of the view, plus space for the left
Drawable if any.
| |||||||||||
Returns the right padding of the view, plus space for the right
Drawable if any.
| |||||||||||
Returns the top padding of the view, plus space for the top
Drawable if any.
| |||||||||||
Return the current color selected to paint the hint text. | |||||||||||
Return the current color selected for normal text. | |||||||||||
Return the text the TextView is displaying as an Editable object.
| |||||||||||
Returns where, if anywhere, words that are longer than the view
is wide should be ellipsized.
| |||||||||||
Returns the error message that was set to be displayed with
setError(CharSequence), or
null if no error was set
or if it the error was cleared by the widget after user input. | |||||||||||
Returns the extended bottom padding of the view, including both the
bottom Drawable if any and any extra space to keep more than maxLines
of text from showing.
| |||||||||||
Returns the extended top padding of the view, including both the
top Drawable if any and any extra space to keep more than maxLines
of text from showing.
| |||||||||||
Returns the current list of input filters.
| |||||||||||
When a view has focus and the user navigates away from it, the next view is searched for
starting from the rectangle filled in by this method.
| |||||||||||
Return whether this text view is including its entire text contents
in frozen icicles.
| |||||||||||
Returns the horizontal and vertical alignment of this TextView.
| |||||||||||
Returns the hint that is displayed when the text of the TextView
is empty.
| |||||||||||
Return the color used to paint the hint text. | |||||||||||
Get the IME action ID previous set with setImeActionLabel(CharSequence, int).
| |||||||||||
Get the IME action label previous set with setImeActionLabel(CharSequence, int).
| |||||||||||
Get the type of the IME editor.
| |||||||||||
Retrieve the input extras currently associated with the text view, which
can be viewed as well as modified.
| |||||||||||
Get the type of the content.
| |||||||||||
Return the baseline for the specified line (0...getLineCount() - 1)
If bounds is not null, return the top, left, right, bottom extents
of the specified line in it.
| |||||||||||
Return the number of lines of text, or 0 if the internal Layout has not
been built.
| |||||||||||
Returns the color used to paint links in the text. | |||||||||||
Returns whether the movement method will automatically be set to
LinkMovementMethod if setAutoLinkMask(int) has been
set to nonzero and links are detected in setText(char[], int, int).
| |||||||||||
Get the private type of the content.
| |||||||||||
Convenience for getSelectionEnd(CharSequence).
| |||||||||||
Convenience for getSelectionStart(CharSequence).
| |||||||||||
Return the text the TextView is displaying.
| |||||||||||
Returns the default color from the TextView_textColor attribute
from the AttributeSet, if set, or the default color from the
TextAppearance_textColor from the TextView_textAppearance attribute,
if TextView_textColor was not set directly.
| |||||||||||
Return the set of text colors.
| |||||||||||
Returns the TextView_textColor attribute from the
Resources.StyledAttributes, if set, or the TextAppearance_textColor
from the TextView_textAppearance attribute, if TextView_textColor
was not set directly.
| |||||||||||
Returns the total bottom padding of the view, including the bottom
Drawable if any, the extra space to keep more than maxLines
from showing, and the vertical offset for gravity, if any.
| |||||||||||
Returns the total left padding of the view, including the left
Drawable if any.
| |||||||||||
Returns the total right padding of the view, including the right
Drawable if any.
| |||||||||||
Returns the total top padding of the view, including the top
Drawable if any, the extra space to keep more than maxLines
from showing, and the vertical offset for gravity, if any.
| |||||||||||
Returns the list of URLSpans attached to the text
(by Linkify or otherwise) if any.
| |||||||||||
Return true iff there is a selection inside this text view.
| |||||||||||
Returns whether this text view is a current input method target.
| |||||||||||
Returns the length, in characters, of the text managed by this TextView
| |||||||||||
Move the cursor, if needed, so that it is at an offset that is visible
to the user.
| |||||||||||
Called by the framework in response to a request to begin a batch
of edit operations through a call to link beginBatchEdit().
| |||||||||||
Check whether the called view is a text editor, in which case it
would make sense to automatically display a soft input window for
it.
| |||||||||||
Called by the framework in response to a text completion from
the current input method, provided by it calling
InputConnection.commitCompletion().
| |||||||||||
Create a new InputConnection for an InputMethod to interact
with the view.
| |||||||||||
Called when an attached input method calls
InputConnection.performEditorAction()
for this text view.
| |||||||||||
Called by the framework in response to a request to end a batch
of edit operations through a call to link endBatchEdit().
| |||||||||||
Called after onStartTemporaryDetach() when the container is done
changing the view.
| |||||||||||
Default implementation of KeyEvent.Callback.onKeyMultiple(): perform press of the view
when KEYCODE_DPAD_CENTER or KEYCODE_ENTER
is released, if the view is enabled and clickable.
| |||||||||||
Default implementation of KeyEvent.Callback.onKeyMultiple(): always returns false (doesn't handle
the event).
| |||||||||||
Called when an unhandled key shortcut event occurs.
| |||||||||||
Default implementation of KeyEvent.Callback.onKeyMultiple(): perform clicking of the view
when KEYCODE_DPAD_CENTER or
KEYCODE_ENTER is released.
| |||||||||||
Callback method to be invoked when the view tree is about to be drawn.
| |||||||||||
Called by the framework in response to a private command from the
current method, provided by it calling
InputConnection.performPrivateCommand().
| |||||||||||
Hook allowing a view to re-apply a representation of its internal state that had previously
been generated by onSaveInstanceState().
| |||||||||||
Hook allowing a view to generate a representation of its internal state
that can later be used to create a new instance with that same state.
| |||||||||||
This is called when a container is going to temporarily detach a child
that currently has focus, with
ViewGroup.detachViewFromParent.
| |||||||||||
Called when a context menu option for the text view is selected.
| |||||||||||
Implement this method to handle touch screen motion events.
| |||||||||||
Implement this method to handle trackball motion events.
| |||||||||||
Called when the window containing this view gains or loses focus.
| |||||||||||
Call this view's OnLongClickListener, if it is defined.
| |||||||||||
Removes the specified TextWatcher from the list of those whose
methods are called
whenever this TextView's text changes.
| |||||||||||
Sets the autolink mask of the text.
| |||||||||||
Sets the size of the padding between the compound drawables and
the text.
| |||||||||||
Sets the Drawables (if any) to appear to the left of, above,
to the right of, and below the text.
| |||||||||||
Sets the Drawables (if any) to appear to the left of, above,
to the right of, and below the text.
| |||||||||||
Sets the Drawables (if any) to appear to the left of, above,
to the right of, and below the text.
| |||||||||||
Set whether the cursor is visible.
| |||||||||||
Sets the Factory used to create new Editables.
| |||||||||||
Causes words in the text that are longer than the view is wide
to be ellipsized instead of broken in the middle.
| |||||||||||
Makes the TextView exactly this many ems wide
| |||||||||||
Sets the right-hand compound drawable of the TextView to the "error"
icon and sets an error message that will be displayed in a popup when
the TextView has focus.
| |||||||||||
Sets the right-hand compound drawable of the TextView to the specified
icon and sets an error message that will be displayed in a popup when
the TextView has focus.
| |||||||||||
Apply to this text view the given extracted text, as previously
returned by extractText(ExtractedTextRequest, ExtractedText).
| |||||||||||
Sets the list of input filters that will be used if the buffer is
Editable.
| |||||||||||
Control whether this text view saves its entire text contents when
freezing to an icicle, in addition to dynamic state such as cursor
position.
| |||||||||||
Sets the horizontal alignment of the text and the
vertical gravity that will be used when there is extra space
in the TextView beyond what is required for the text itself.
| |||||||||||
Makes the TextView exactly this many pixels tall.
| |||||||||||
Sets the color used to display the selection highlight.
| |||||||||||
Sets the text to be displayed when the text of the TextView is empty.
| |||||||||||
Sets the text to be displayed when the text of the TextView is empty,
from a resource.
| |||||||||||
Sets the color of the hint text.
| |||||||||||
Sets the color of the hint text.
| |||||||||||
Sets whether the text should be allowed to be wider than the
View is.
| |||||||||||
Change the custom IME action associated with the text view, which
will be reported to an IME with actionLabel
and actionId when it has focus.
| |||||||||||
Change the editor type integer associated with the text view, which
will be reported to an IME with imeOptions when it
has focus.
| |||||||||||
Set whether the TextView includes extra top and bottom padding to make
room for accents that go above the normal ascent and descent.
| |||||||||||
Set the extra input data of the text, which is the
TextBoxAttribute.extras
Bundle that will be filled in when creating an input connection.
| |||||||||||
Set the type of the content with a constant as defined for
inputType.
| |||||||||||
Sets the key listener to be used with this TextView.
| |||||||||||
Sets line spacing for this TextView.
| |||||||||||
Makes the TextView exactly this many lines tall
| |||||||||||
Sets the color of links in the text.
| |||||||||||
Sets the color of links in the text.
| |||||||||||
Sets whether the movement method will automatically be set to
LinkMovementMethod if setAutoLinkMask(int) has been
set to nonzero and links are detected in setText(char[], int, int).
| |||||||||||
Sets how many times to repeat the marquee animation.
| |||||||||||
Makes the TextView at most this many ems wide
| |||||||||||
Makes the TextView at most this many pixels tall
| |||||||||||
Makes the TextView at most this many lines tall
| |||||||||||
Makes the TextView at most this many pixels wide
| |||||||||||
Makes the TextView at least this many ems wide
| |||||||||||
Makes the TextView at least this many pixels tall
| |||||||||||
Makes the TextView at least this many lines tall
| |||||||||||
Makes the TextView at least this many pixels wide
| |||||||||||
Sets the movement method (arrow key handler) to be used for
this TextView.
| |||||||||||
Set a special listener to be called when an action is performed
on the text view.
| |||||||||||
Sets the padding.
| |||||||||||
Sets flags on the Paint being used to display the text and
reflows the text if they are different from the old flags.
| |||||||||||
Set the private content type of the text, which is the
EditorInfo.privateImeOptions
field that will be filled in when creating an input connection.
| |||||||||||
Directly change the content type integer of the text view, without
modifying any other state.
| |||||||||||
Set the TextView so that when it takes focus, all the text is
selected.
| |||||||||||
Changes the selection state of this view.
| |||||||||||
Gives the text a shadow of the specified radius and color, the specified
distance from its normal position.
| |||||||||||
Sets the properties of this field (lines, horizontally scrolling,
transformation method) to be for a single-line input.
| |||||||||||
If true, sets the properties of this field (lines, horizontally
scrolling, transformation method) to be for a single-line input;
if false, restores these to the default conditions.
| |||||||||||
Sets the Factory used to create new Spannables.
| |||||||||||
Sets the TextView to display the specified slice of the specified
char array.
| |||||||||||
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.
| |||||||||||
Sets the string value of the TextView.
| |||||||||||
Sets the text color, size, style, hint color, and highlight color
from the specified TextAppearance resource.
| |||||||||||
Sets the text color for all the states (normal, selected,
focused) to be this color.
| |||||||||||
Sets the text color.
| |||||||||||
Like setText(CharSequence),
except that the cursor position (if any) is retained in the new text.
| |||||||||||
Like setText(CharSequence, android.widget.TextView.BufferType),
except that the cursor position (if any) is retained in the new text.
| |||||||||||
Sets the extent by which text should be stretched horizontally.
| |||||||||||
Set the default text size to a given unit and value.
| |||||||||||
Set the default text size to the given value, interpreted as "scaled
pixel" units.
| |||||||||||
Sets the transformation that is applied to the text that this
TextView is displaying.
| |||||||||||
Sets the typeface and style in which the text should be displayed,
and turns on the fake bold and italic bits in the Paint if the
Typeface that you provided does not have all the bits in the
style that you specified.
| |||||||||||
Sets the typeface and style in which the text should be displayed.
| |||||||||||
Makes the TextView exactly this many pixels wide.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Compute the horizontal range that the horizontal scrollbar represents. | |||||||||||
Compute the vertical extent of the horizontal scrollbar's thumb within the vertical range. | |||||||||||
Compute the vertical range that the vertical scrollbar represents. | |||||||||||
This function is called whenever the state of the view changes in such
a way that it impacts the state of drawables being shown.
| |||||||||||
Amount by which to extend the bottom fading region.
| |||||||||||
Subclasses override this to specify that they have a KeyListener
by default even if not specifically called for in the XML options.
| |||||||||||
Subclasses override this to specify a default movement method.
| |||||||||||
Returns the strength, or intensity, of the left faded edge.
| |||||||||||
Amount by which to extend the left fading region.
| |||||||||||
Returns the strength, or intensity, of the right faded edge.
| |||||||||||
Amount by which to extend the right fading region.
| |||||||||||
Amount by which to extend the top fading region.
| |||||||||||
If the View draws content inside its padding and enables fading edges,
it needs to support padding offsets.
| |||||||||||
This is called when the view is attached to a window.
| |||||||||||
Views should implement this if the view itself is going to add items to
the context menu.
| |||||||||||
This is called when the view is detached from a window.
| |||||||||||
Implement this to do your drawing.
| |||||||||||
Called by the view system when the focus state of this view changes.
| |||||||||||
Measure the view and its content to determine the measured width and the measured height. | |||||||||||
This method is called when the selection has changed, in case any
subclasses would like to know.
| |||||||||||
This method is called when the text is changed, in case any
subclasses would like to know.
| |||||||||||
Assign a size and position to this view.
| |||||||||||
If your view subclass is displaying its own Drawable objects, it should
override this function and return true for any Drawable it is
displaying.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
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
|
Controls whether links such as urls and email addresses are automatically found and converted to clickable links. The default value is "none", disabling this feature.
Must be one or more (separated by '|') of the following constant values.
Constant | Value | Description |
---|---|---|
none | 0x00 | Match no patterns (default) |
web | 0x01 | Match Web URLs |
email | 0x02 | Match email addresses |
phone | 0x04 | Match phone numbers |
map | 0x08 | Match map addresses |
all | 0x0f | Match all patterns (equivalent to web|email|phone|map) |
This corresponds to the global attribute resource symbol autoLink.
If set, specifies that this TextView has a textual input method and automatically corrects some common spelling errors. The default is "false".
Must be a boolean value, either "true
" or "false
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol autoText.
Determines the minimum type that getText() will return. The default is "normal". Note that EditText and LogTextBox always return Editable, even if you specify something less powerful here.
Must be one of the following constant values.
Constant | Value | Description |
---|---|---|
normal | 0 | Can return any CharSequence, possibly a Spanned one if the source text was Spanned. |
spannable | 1 | Can only return Spannable. |
editable | 2 | Can only return Spannable and Editable. |
This corresponds to the global attribute resource symbol bufferType.
If set, specifies that this TextView has a textual input method and should automatically capitalize what the user types. The default is "none".
Must be one of the following constant values.
Constant | Value | Description |
---|---|---|
none | 0 | Don't automatically capitalize anything. |
sentences | 1 | Capitalize the first word of each sentence. |
words | 2 | Capitalize the first letter of every word. |
characters | 3 | Capitalize every character. |
This corresponds to the global attribute resource symbol capitalize.
Makes the cursor visible (the default) or invisible
Must be a boolean value, either "true
" or "false
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol cursorVisible.
If set, specifies that this TextView has a numeric input method and that these specific characters are the ones that it will accept. If this is set, numeric is implied to be true. The default is false.
Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character.
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol digits.
The drawable to be drawn below the text.
May be a reference to another resource, in the form "@[+][package:]type:name
"
or to a theme attribute in the form "?[package:][type:]name
".
May be a color value, in the form of "#rgb
", "#argb
",
"#rrggbb
", or "#aarrggbb
".
This corresponds to the global attribute resource symbol drawableBottom.
The drawable to be drawn to the left of the text.
May be a reference to another resource, in the form "@[+][package:]type:name
"
or to a theme attribute in the form "?[package:][type:]name
".
May be a color value, in the form of "#rgb
", "#argb
",
"#rrggbb
", or "#aarrggbb
".
This corresponds to the global attribute resource symbol drawableLeft.
The padding between the drawables and the text.
Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp
".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol drawablePadding.
The drawable to be drawn to the right of the text.
May be a reference to another resource, in the form "@[+][package:]type:name
"
or to a theme attribute in the form "?[package:][type:]name
".
May be a color value, in the form of "#rgb
", "#argb
",
"#rrggbb
", or "#aarrggbb
".
This corresponds to the global attribute resource symbol drawableRight.
The drawable to be drawn above the text.
May be a reference to another resource, in the form "@[+][package:]type:name
"
or to a theme attribute in the form "?[package:][type:]name
".
May be a color value, in the form of "#rgb
", "#argb
",
"#rrggbb
", or "#aarrggbb
".
This corresponds to the global attribute resource symbol drawableTop.
If set, specifies that this TextView has an input method. It will be a textual one unless it has otherwise been specified. For TextView, this is false by default. For EditText, it is true by default.
Must be a boolean value, either "true
" or "false
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol editable.
Reference to an <input-extras> XML resource containing additional data to supply to an input method, which is private to the implementation of the input method. This simply fills in the EditorInfo.extras field when the input method is connected.
Must be a reference to another resource, in the form "@[+][package:]type:name
"
or to a theme attribute in the form "?[package:][type:]name
".
This corresponds to the global attribute resource symbol editorExtras.
If set, causes words that are longer than the view is wide to be ellipsized instead of broken in the middle. You will often also want to set scrollHorizontally or singleLine as well so that the text as a whole is also constrained to a single line instead of still allowed to be broken onto multiple lines.
Must be one of the following constant values.
Constant | Value | Description |
---|---|---|
none | 0 | |
start | 1 | |
middle | 2 | |
end | 3 | |
marquee | 4 |
This corresponds to the global attribute resource symbol ellipsize.
Makes the TextView be exactly this many ems wide
Must be an integer value, such as "100
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol ems.
If set, the text view will include its current complete text inside of its frozen icicle in addition to meta-data such as the current cursor position. By default this is disabled; it can be useful when the contents of a text view is not stored in a persistent place such as a content provider.
Must be a boolean value, either "true
" or "false
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol freezesText.
Specifies how to align the text by the view's x and/or y axis when the text is smaller than the view.
Must be one or more (separated by '|') of the following constant values.
Constant | Value | Description |
---|---|---|
top | 0x30 | Push object to the top of its container, not changing its size. |
bottom | 0x50 | Push object to the bottom of its container, not changing its size. |
left | 0x03 | Push object to the left of its container, not changing its size. |
right | 0x05 | Push object to the right of its container, not changing its size. |
center_vertical | 0x10 | Place object in the vertical center of its container, not changing its size. |
fill_vertical | 0x70 | Grow the vertical size of the object if needed so it completely fills its container. |
center_horizontal | 0x01 | Place object in the horizontal center of its container, not changing its size. |
fill_horizontal | 0x07 | Grow the horizontal size of the object if needed so it completely fills its container. |
center | 0x11 | Place the object in the center of its container in both the vertical and horizontal axis, not changing its size. |
fill | 0x77 | Grow the horizontal and vertical size of the object if needed so it completely fills its container. |
clip_vertical | 0x80 | Additional option that can be set to have the top and/or bottom edges of the child clipped to its container's bounds. The clip will be based on the vertical gravity: a top gravity will clip the bottom edge, a bottom gravity will clip the top edge, and neither will clip both edges. |
clip_horizontal | 0x08 | Additional option that can be set to have the left and/or right edges of the child clipped to its container's bounds. The clip will be based on the horizontal gravity: a left gravity will clip the right edge, a right gravity will clip the left edge, and neither will clip both edges. |
This corresponds to the global attribute resource symbol gravity.
Makes the TextView be exactly this many pixels tall. You could get the same effect by specifying this number in the layout parameters.
Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp
".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol height.
Hint text to display when the text is empty.
Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character.
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol hint.
Supply a value for EditorInfo.actionId used when an input method is connected to the text view.
Must be an integer value, such as "100
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol imeActionId.
Supply a value for EditorInfo.actionLabel used when an input method is connected to the text view.
Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character.
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol imeActionLabel.
Additional features you can enable in an IME associated with an editor, to improve the integration with your application. The constants here correspond to those defined by imeOptions.
Must be one or more (separated by '|') of the following constant values.
Constant | Value | Description |
---|---|---|
normal | 0x00000000 | There are no special semantics associated with this editor. |
actionUnspecified | 0x00000000 | There is no specific action associated with this editor, let the editor come up with its own if it can. Corresponds to IME_NULL. |
actionNone | 0x00000001 | This editor has no action associated with it. Corresponds to IME_ACTION_NONE. |
actionGo | 0x00000002 | The action key performs a "go" operation to take the user to the target of the text they typed. Typically used, for example, when entering a URL. Corresponds to IME_ACTION_GO. |
actionSearch | 0x00000003 | The action key performs a "search" operation, taking the user to the results of searching for the text the have typed (in whatever context is appropriate). Corresponds to IME_ACTION_SEARCH. |
actionSend | 0x00000004 | The action key performs a "send" operation, delivering the text to its target. This is typically used when composing a message. Corresponds to IME_ACTION_SEND. |
actionNext | 0x00000005 | The action key performs a "next" operation, taking the user to the next field that will accept text. Corresponds to IME_ACTION_NEXT. |
actionDone | 0x00000006 | The action key performs a "done" operation, closing the soft input method. Corresponds to IME_ACTION_DONE. |
flagNoExtractUi | 0x10000000 | Used to specify that the IME does not need
to show its extracted text UI. For input methods that may be fullscreen,
often when in landscape mode, this allows them to be smaller and let part
of the application be shown behind. Though there will likely be limited
access to the application available from the user, it can make the
experience of a (mostly) fullscreen IME less jarring. Note that when
this flag is specified the IME may not be set up to be able
to display text, so it should only be used in situations where this is
not needed.
Corresponds to IME_FLAG_NO_EXTRACT_UI. |
flagNoAccessoryAction | 0x20000000 | Used in conjunction with a custom action, this indicates that the
action should not be available as an accessory button when the
input method is full-screen.
Note that by setting this flag, there can be cases where the action
is simply never available to the user. Setting this generally means
that you think showing text being edited is more important than the
action you have supplied.
Corresponds to IME_FLAG_NO_ACCESSORY_ACTION. |
flagNoEnterAction | 0x40000000 | Used in conjunction with a custom action,
this indicates that the action should not be available in-line as
a replacement for the "enter" key. Typically this is
because the action has such a significant impact or is not recoverable
enough that accidentally hitting it should be avoided, such as sending
a message. Note that TextView will
automatically set this flag for you on multi-line text views.
Corresponds to IME_FLAG_NO_ENTER_ACTION. |
This corresponds to the global attribute resource symbol imeOptions.
Leave enough room for ascenders and descenders instead of using the font ascent and descent strictly. (Normally true).
Must be a boolean value, either "true
" or "false
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol includeFontPadding.
If set, specifies that this TextView should use the specified input method (specified by fully-qualified class name).
Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character.
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol inputMethod.
The type of data being placed in a text field, used to help an input method decide how to let the user enter text. The constants here correspond to those defined by InputType. Generally you can select a single value, though some can be combined together as indicated. Setting this attribute to anything besides none also implies that the text is editable.
Must be one or more (separated by '|') of the following constant values.
Constant | Value | Description |
---|---|---|
none | 0x00000000 | There is no content type. The text is not editable. |
text | 0x00000001 | Just plain old text. Corresponds to TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_NORMAL. |
textCapCharacters | 0x00001001 | Can be combined with text and its variations to request capitalization of all characters. Corresponds to TYPE_TEXT_FLAG_CAP_CHARACTERS. |
textCapWords | 0x00002001 | Can be combined with text and its variations to request capitalization of the first character of every word. Corresponds to TYPE_TEXT_FLAG_CAP_WORDS. |
textCapSentences | 0x00004001 | Can be combined with text and its variations to request capitalization of the first character of every sentence. Corresponds to TYPE_TEXT_FLAG_CAP_SENTENCES. |
textAutoCorrect | 0x00008001 | Can be combined with text and its variations to request auto-correction of text being input. Corresponds to TYPE_TEXT_FLAG_AUTO_CORRECT. |
textAutoComplete | 0x00010001 | Can be combined with text and its variations to specify that this field will be doing its own auto-completion and talking with the input method appropriately. Corresponds to TYPE_TEXT_FLAG_AUTO_COMPLETE. |
textMultiLine | 0x00020001 | Can be combined with text and its variations to allow multiple lines of text in the field. If this flag is not set, the text field will be constrained to a single line. Corresponds to TYPE_TEXT_FLAG_MULTI_LINE. |
textImeMultiLine | 0x00040001 | Can be combined with text and its variations to indicate that though the regular text view should not be multiple lines, the IME should provide multiple lines if it can. Corresponds to TYPE_TEXT_FLAG_IME_MULTI_LINE. |
textUri | 0x00000011 | Text that will be used as a URI. Corresponds to TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_URI. |
textEmailAddress | 0x00000021 | Text that will be used as an e-mail address. Corresponds to TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_EMAIL_ADDRESS. |
textEmailSubject | 0x00000031 | Text that is being supplied as the subject of an e-mail. Corresponds to TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_EMAIL_SUBJECT. |
textShortMessage | 0x00000041 | Text that is the content of a short message. Corresponds to TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_SHORT_MESSAGE. |
textLongMessage | 0x00000051 | Text that is the content of a long message. Corresponds to TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_LONG_MESSAGE. |
textPersonName | 0x00000061 | Text that is the name of a person. Corresponds to TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_PERSON_NAME. |
textPostalAddress | 0x00000071 | Text that is being supplied as a postal mailing address. Corresponds to TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_POSTAL_ADDRESS. |
textPassword | 0x00000081 | Text that is a password. Corresponds to TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_PASSWORD. |
textVisiblePassword | 0x00000091 | Text that is a password that should be visible. Corresponds to TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_VISIBLE_PASSWORD. |
textWebEditText | 0x000000a1 | Text that is being supplied as text in a web form. Corresponds to TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_WEB_EDIT_TEXT. |
textFilter | 0x000000b1 | Text that is filtering some other data. Corresponds to TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_FILTER. |
textPhonetic | 0x000000c1 | Text that is for phonetic pronunciation, such as a phonetic name field in a contact entry. Corresponds to TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_PHONETIC. |
number | 0x00000002 | A numeric only field. Corresponds to TYPE_CLASS_NUMBER. |
numberSigned | 0x00001002 | Can be combined with number and its other options to allow a signed number. Corresponds to TYPE_CLASS_NUMBER | TYPE_NUMBER_FLAG_SIGNED. |
numberDecimal | 0x00002002 | Can be combined with number and its other options to allow a decimal (fractional) number. Corresponds to TYPE_CLASS_NUMBER | TYPE_NUMBER_FLAG_DECIMAL. |
phone | 0x00000003 | For entering a phone number. Corresponds to TYPE_CLASS_PHONE. |
datetime | 0x00000004 | For entering a date and time. Corresponds to TYPE_CLASS_DATETIME | TYPE_DATETIME_VARIATION_NORMAL. |
date | 0x00000014 | For entering a date. Corresponds to TYPE_CLASS_DATETIME | TYPE_DATETIME_VARIATION_DATE. |
time | 0x00000024 | For entering a time. Corresponds to TYPE_CLASS_DATETIME | TYPE_DATETIME_VARIATION_TIME. |
This corresponds to the global attribute resource symbol inputType.
Extra spacing between lines of text.
Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp
".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol lineSpacingExtra.
Extra spacing between lines of text, as a multiplier.
Must be a floating point value, such as "1.2
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol lineSpacingMultiplier.
Makes the TextView be exactly this many lines tall
Must be an integer value, such as "100
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol lines.
If set to false, keeps the movement method from being set to the link movement method even if autoLink causes links to be found.
Must be a boolean value, either "true
" or "false
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol linksClickable.
The number of times to repeat the marquee animation. Only applied if the TextView has marquee enabled.
May be an integer value, such as "100
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
May be one of the following constant values.
Constant | Value | Description |
---|---|---|
marquee_forever | -1 | Indicates that marquee should repeat indefinitely |
This corresponds to the global attribute resource symbol marqueeRepeatLimit.
Makes the TextView be at most this many ems wide
Must be an integer value, such as "100
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol maxEms.
Makes the TextView be at most this many pixels tall
Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp
".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol maxHeight.
Set an input filter to constrain the text length to the specified number.
Must be an integer value, such as "100
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol maxLength.
Makes the TextView be at most this many lines tall
Must be an integer value, such as "100
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol maxLines.
Makes the TextView be at most this many pixels wide
Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp
".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol maxWidth.
Makes the TextView be at least this many ems wide
Must be an integer value, such as "100
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol minEms.
Makes the TextView be at least this many pixels tall
Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp
".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol minHeight.
Makes the TextView be at least this many lines tall
Must be an integer value, such as "100
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol minLines.
Makes the TextView be at least this many pixels wide
Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp
".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol minWidth.
If set, specifies that this TextView has a numeric input method. The default is false.
Must be one or more (separated by '|') of the following constant values.
Constant | Value | Description |
---|---|---|
integer | 0x01 | Input is numeric. |
signed | 0x003 | Input is numeric, with sign allowed. |
decimal | 0x05 | Input is numeric, with decimals allowed. |
This corresponds to the global attribute resource symbol numeric.
Whether the characters of the field are displayed as password dots instead of themselves.
Must be a boolean value, either "true
" or "false
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol password.
If set, specifies that this TextView has a phone number input method. The default is false.
Must be a boolean value, either "true
" or "false
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol phoneNumber.
An addition content type description to supply to the input method attached to the text view, which is private to the implementation of the input method. This simply fills in the EditorInfo.privateImeOptions field when the input method is connected.
Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character.
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol privateImeOptions.
Whether the text is allowed to be wider than the view (and therefore can be scrolled horizontally).
Must be a boolean value, either "true
" or "false
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol scrollHorizontally.
If the text is selectable, select it all when the view takes focus instead of moving the cursor to the start or end.
Must be a boolean value, either "true
" or "false
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol selectAllOnFocus.
Place a shadow of the specified color behind the text.
Must be a color value, in the form of "#rgb
", "#argb
",
"#rrggbb
", or "#aarrggbb
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol shadowColor.
Horizontal offset of the shadow.
Must be a floating point value, such as "1.2
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol shadowDx.
Vertical offset of the shadow.
Must be a floating point value, such as "1.2
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol shadowDy.
Radius of the shadow.
Must be a floating point value, such as "1.2
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol shadowRadius.
Constrains the text to a single horizontally scrolling line instead of letting it wrap onto multiple lines, and advances focus instead of inserting a newline when you press the enter key. Note: for editable text views, it is better to control this using the textMultiLine flag in the inputType attribute. (If both singleLine and inputType are supplied, the inputType flags will override the value of singleLine.)
Must be a boolean value, either "true
" or "false
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol singleLine.
Text to display.
Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character.
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol text.
Text color.
May be a reference to another resource, in the form "@[+][package:]type:name
"
or to a theme attribute in the form "?[package:][type:]name
".
May be a color value, in the form of "#rgb
", "#argb
",
"#rrggbb
", or "#aarrggbb
".
This corresponds to the global attribute resource symbol textColor.
Color of the text selection highlight.
May be a reference to another resource, in the form "@[+][package:]type:name
"
or to a theme attribute in the form "?[package:][type:]name
".
May be a color value, in the form of "#rgb
", "#argb
",
"#rrggbb
", or "#aarrggbb
".
This corresponds to the global attribute resource symbol textColorHighlight.
Color of the hint text.
May be a reference to another resource, in the form "@[+][package:]type:name
"
or to a theme attribute in the form "?[package:][type:]name
".
May be a color value, in the form of "#rgb
", "#argb
",
"#rrggbb
", or "#aarrggbb
".
This corresponds to the global attribute resource symbol textColorHint.
Text color for links.
May be a reference to another resource, in the form "@[+][package:]type:name
"
or to a theme attribute in the form "?[package:][type:]name
".
May be a color value, in the form of "#rgb
", "#argb
",
"#rrggbb
", or "#aarrggbb
".
This corresponds to the global attribute resource symbol textColorLink.
Sets the horizontal scaling factor for the text
Must be a floating point value, such as "1.2
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol textScaleX.
Size of the text. Recommended dimension type for text is "sp" for scaled-pixels (example: 15sp).
Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp
".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol textSize.
Style (bold, italic, bolditalic) for the text.
Must be one or more (separated by '|') of the following constant values.
Constant | Value | Description |
---|---|---|
normal | 0 | |
bold | 1 | |
italic | 2 |
This corresponds to the global attribute resource symbol textStyle.
Typeface (normal, sans, serif, monospace) for the text.
Must be one of the following constant values.
Constant | Value | Description |
---|---|---|
normal | 0 | |
sans | 1 | |
serif | 2 | |
monospace | 3 |
This corresponds to the global attribute resource symbol typeface.
Makes the TextView be exactly this many pixels wide. You could get the same effect by specifying this number in the layout parameters.
Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp
".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol width.
Adds a TextWatcher to the list of those whose methods are called whenever this TextView's text changes.
In 1.0, the afterTextChanged(Editable) method was erroneously not called after setText(char[], int, int) calls. Now, doing setText(char[], int, int) if there are any text changed listeners forces the buffer type to Editable if it would not otherwise be and does call this method.
Convenience method: Append the specified text to the TextView's display buffer, upgrading it to BufferType.EDITABLE if it was not already editable.
Convenience method: Append the specified text slice to the TextView's display buffer, upgrading it to BufferType.EDITABLE if it was not already editable.
Move the point, specified by the offset, into the view if it is needed. This has to be called after layout. Returns true if anything changed.
Cancels a pending long press. Your subclass can use this if you want the context menu to come up if the user presses and holds at the same place, but you don't want it to come up if they press and then move around enough to cause scrolling.
Use BaseInputConnection.removeComposingSpans() to remove any IME composing state from this text view.
Called by a parent to request that a child update its values for mScrollX and mScrollY if necessary. This will typically be done if the child is animating a scroll using a Scroller object.
Prints information about this view in the log output, with the tag
VIEW_LOG_TAG. Each line in the output is preceded with an
indentation defined by the depth
.
depth | the indentation level |
---|
Returns true, only while processing a touch gesture, if the initial touch down event caused focus to move to the text view and as a result its selection changed. Only valid while processing the touch gesture of interest.
If this TextView contains editable content, extract a portion of it based on the information in request in to outText.
Gets the autolink mask of the text. See Linkify.ALL and peers for possible values.
Return the offset of the widget's text baseline from the widget's top boundary. If this widget does not support baseline alignment, this method returns -1.
Returns the padding between the compound drawables and the text.
Returns drawables for the left, top, right, and bottom borders.
Returns the bottom padding of the view, plus space for the bottom Drawable if any.
Returns the left padding of the view, plus space for the left Drawable if any.
Returns the right padding of the view, plus space for the right Drawable if any.
Returns the top padding of the view, plus space for the top Drawable if any.
Return the current color selected to paint the hint text.
Return the current color selected for normal text.
Return the text the TextView is displaying as an Editable object. If the text is not editable, null is returned.
Returns where, if anywhere, words that are longer than the view is wide should be ellipsized.
Returns the error message that was set to be displayed with
setError(CharSequence), or null
if no error was set
or if it the error was cleared by the widget after user input.
Returns the extended bottom padding of the view, including both the bottom Drawable if any and any extra space to keep more than maxLines of text from showing. It is only valid to call this after measuring.
Returns the extended top padding of the view, including both the top Drawable if any and any extra space to keep more than maxLines of text from showing. It is only valid to call this after measuring.
Returns the current list of input filters.
When a view has focus and the user navigates away from it, the next view is searched for starting from the rectangle filled in by this method. By default, the rectange is the getDrawingRect(Rect))of the view. However, if your view maintains some idea of internal selection, such as a cursor, or a selected row or column, you should override this method and fill in a more specific rectangle.
r | The rectangle to fill in, in this view's coordinates. |
---|
Return whether this text view is including its entire text contents in frozen icicles.
Returns the horizontal and vertical alignment of this TextView.
Returns the hint that is displayed when the text of the TextView is empty.
Return the color used to paint the hint text.
Get the IME action ID previous set with setImeActionLabel(CharSequence, int).
Get the IME action label previous set with setImeActionLabel(CharSequence, int).
Get the type of the IME editor.
Retrieve the input extras currently associated with the text view, which can be viewed as well as modified.
create | If true, the extras will be created if they don't already exist. Otherwise, null will be returned if none have been created. |
---|
Get the type of the content.
Return the baseline for the specified line (0...getLineCount() - 1) If bounds is not null, return the top, left, right, bottom extents of the specified line in it. If the internal Layout has not been built, return 0 and set bounds to (0, 0, 0, 0)
line | which line to examine (0..getLineCount() - 1) |
---|---|
bounds | Optional. If not null, it returns the extent of the line |
Return the number of lines of text, or 0 if the internal Layout has not been built.
Returns the color used to paint links in the text.
Returns whether the movement method will automatically be set to LinkMovementMethod if setAutoLinkMask(int) has been set to nonzero and links are detected in setText(char[], int, int). The default is true.
Get the private type of the content.
Convenience for getSelectionEnd(CharSequence).
Convenience for getSelectionStart(CharSequence).
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.
Returns the default color from the TextView_textColor attribute from the AttributeSet, if set, or the default color from the TextAppearance_textColor from the TextView_textAppearance attribute, if TextView_textColor was not set directly.
Return the set of text colors.
Returns the TextView_textColor attribute from the Resources.StyledAttributes, if set, or the TextAppearance_textColor from the TextView_textAppearance attribute, if TextView_textColor was not set directly.
Returns the total bottom padding of the view, including the bottom Drawable if any, the extra space to keep more than maxLines from showing, and the vertical offset for gravity, if any.
Returns the total left padding of the view, including the left Drawable if any.
Returns the total right padding of the view, including the right Drawable if any.
Returns the total top padding of the view, including the top Drawable if any, the extra space to keep more than maxLines from showing, and the vertical offset for gravity, if any.
Returns the list of URLSpans attached to the text (by Linkify or otherwise) if any. You can call getURL() on them to find where they link to or use getSpanStart(Object) and getSpanEnd(Object) to find the region of the text they are attached to.
Return true iff there is a selection inside this text view.
Returns whether this text view is a current input method target. The default implementation just checks with InputMethodManager.
Returns the length, in characters, of the text managed by this TextView
Move the cursor, if needed, so that it is at an offset that is visible to the user. This will not move the cursor if it represents more than one character (a selection range). This will only work if the TextView contains spannable text; otherwise it will do nothing.
Called by the framework in response to a request to begin a batch of edit operations through a call to link beginBatchEdit().
Check whether the called view is a text editor, in which case it would make sense to automatically display a soft input window for it. Subclasses should override this if they implement onCreateInputConnection(EditorInfo) to return true if a call on that method would return a non-null InputConnection, and they are really a first-class editor that the user would normally start typing on when the go into a window containing your view.
The default implementation always returns false. This does not mean that its onCreateInputConnection(EditorInfo) will not be called or the user can not otherwise perform edits on your view; it is just a hint to the system that this is not the primary purpose of this view.
Called by the framework in response to a text completion from the current input method, provided by it calling InputConnection.commitCompletion(). The default implementation does nothing; text views that are supporting auto-completion should override this to do their desired behavior.
text | The auto complete text the user has selected. |
---|
Create a new InputConnection for an InputMethod to interact with the view. The default implementation returns null, since it doesn't support input methods. You can override this to implement such support. This is only needed for views that take focus and text input.
When implementing this, you probably also want to implement onCheckIsTextEditor() to indicate you will return a non-null InputConnection.
outAttrs | Fill in with attribute information about the connection. |
---|
Called when an attached input method calls InputConnection.performEditorAction() for this text view. The default implementation will call your action listener supplied to setOnEditorActionListener(TextView.OnEditorActionListener), or perform a standard operation for EditorInfo.IME_ACTION_NEXT or EditorInfo.IME_ACTION_DONE.
For backwards compatibility, if no IME options have been set and the text view would not normally advance focus on enter, then the NEXT and DONE actions received here will be turned into an enter key down/up pair to go through the normal key handling.
actionCode | The code of the action being performed. |
---|
Called by the framework in response to a request to end a batch of edit operations through a call to link endBatchEdit().
Called after onStartTemporaryDetach() when the container is done changing the view.
Default implementation of KeyEvent.Callback.onKeyMultiple(): perform press of the view when KEYCODE_DPAD_CENTER or KEYCODE_ENTER is released, if the view is enabled and clickable.
keyCode | A key code that represents the button pressed, from KeyEvent. |
---|---|
event | The KeyEvent object that defines the button action. |
Default implementation of KeyEvent.Callback.onKeyMultiple(): always returns false (doesn't handle the event).
keyCode | A key code that represents the button pressed, from KeyEvent. |
---|---|
repeatCount | The number of times the action was made. |
event | The KeyEvent object that defines the button action. |
Called when an unhandled key shortcut event occurs.
keyCode | The value in event.getKeyCode(). |
---|---|
event | Description of the key event. |
Default implementation of KeyEvent.Callback.onKeyMultiple(): perform clicking of the view when KEYCODE_DPAD_CENTER or KEYCODE_ENTER is released.
keyCode | A key code that represents the button pressed, from KeyEvent. |
---|---|
event | The KeyEvent object that defines the button action. |
Callback method to be invoked when the view tree is about to be drawn. At this point, all views in the tree have been measured and given a frame. Clients can use this to adjust their scroll bounds or even to request a new layout before drawing occurs.
Called by the framework in response to a private command from the current method, provided by it calling InputConnection.performPrivateCommand().
action | The action name of the command. |
---|---|
data | Any additional data for the command. This may be null. |
Hook allowing a view to re-apply a representation of its internal state that had previously been generated by onSaveInstanceState(). This function will never be called with a null state.
state | The frozen state that had previously been returned by onSaveInstanceState(). |
---|
Hook allowing a view to generate a representation of its internal state that can later be used to create a new instance with that same state. This state should only contain information that is not persistent or can not be reconstructed later. For example, you will never store your current position on screen because that will be computed again when a new instance of the view is placed in its view hierarchy.
Some examples of things you may store here: the current cursor position in a text view (but usually not the text itself since that is stored in a content provider or other persistent storage), the currently selected item in a list view.
This is called when a container is going to temporarily detach a child that currently has focus, with ViewGroup.detachViewFromParent. It will either be followed by onFinishTemporaryDetach() or onDetachedFromWindow() when the container is done. Generally this is currently only done ListView for a view with focus.
Called when a context menu option for the text view is selected. Currently this will be one of: selectAll, startSelectingText, stopSelectingText, cut, copy, paste, copyUrl, or switchInputMethod.
Implement this method to handle touch screen motion events.
event | The motion event. |
---|
Implement this method to handle trackball motion events. The relative movement of the trackball since the last event can be retrieve with MotionEvent.getX() and MotionEvent.getY(). These are normalized so that a movement of 1 corresponds to the user pressing one DPAD key (so they will often be fractional values, representing the more fine-grained movement information available from a trackball).
event | The motion event. |
---|
Called when the window containing this view gains or loses focus. Note that this is separate from view focus: to receive key events, both your view and its window must have focus. If a window is displayed on top of yours that takes input focus, then your own window will lose focus but the view focus will remain unchanged.
hasWindowFocus | True if the window containing this view now has focus, false otherwise. |
---|
Call this view's OnLongClickListener, if it is defined. Invokes the context menu if the OnLongClickListener did not consume the event.
Removes the specified TextWatcher from the list of those whose methods are called whenever this TextView's text changes.
Sets the autolink mask of the text. See Linkify.ALL and peers for possible values.
Sets the size of the padding between the compound drawables and the text.
Sets the Drawables (if any) to appear to the left of, above, to the right of, and below the text. Use null if you do not want a Drawable there. The Drawables must already have had setBounds(Rect) called.
Sets the Drawables (if any) to appear to the left of, above, to the right of, and below the text. Use 0 if you do not want a Drawable there. The Drawables' bounds will be set to their intrinsic bounds.
left | Resource identifier of the left Drawable. |
---|---|
top | Resource identifier of the top Drawable. |
right | Resource identifier of the right Drawable. |
bottom | Resource identifier of the bottom Drawable. |
Sets the Drawables (if any) to appear to the left of, above, to the right of, and below the text. Use null if you do not want a Drawable there. The Drawables' bounds will be set to their intrinsic bounds.
Set whether the cursor is visible. The default is true.
Sets the Factory used to create new Editables.
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.
Makes the TextView exactly this many ems wide
Sets the right-hand compound drawable of the TextView to the "error"
icon and sets an error message that will be displayed in a popup when
the TextView has focus. The icon and error message will be reset to
null when any key events cause changes to the TextView's text. If the
error
is null
, the error message and icon
will be cleared.
Sets the right-hand compound drawable of the TextView to the specified
icon and sets an error message that will be displayed in a popup when
the TextView has focus. The icon and error message will be reset to
null when any key events cause changes to the TextView's text. The
drawable must already have had setBounds(Rect) set on it.
If the error
is null
, the error message will
be cleared (and you should provide a null
icon as well).
Apply to this text view the given extracted text, as previously returned by extractText(ExtractedTextRequest, ExtractedText).
Sets the list of input filters that will be used if the buffer is Editable. Has no effect otherwise.
Control whether this text view saves its entire text contents when freezing to an icicle, in addition to dynamic state such as cursor position. By default this is false, not saving the text. Set to true if the text in the text view is not being saved somewhere else in persistent storage (such as in a content provider) so that if the view is later thawed the user will not lose their data.
freezesText | Controls whether a frozen icicle should include the entire text data: true to include it, false to not. |
---|
Sets the horizontal alignment of the text and the vertical gravity that will be used when there is extra space in the TextView beyond what is required for the text itself.
Makes the TextView exactly this many pixels tall. You could do the same thing by specifying this number in the LayoutParams.
Sets the color used to display the selection highlight.
Sets the text to be displayed when the text of the TextView is empty. Null means to use the normal empty text. The hint does not currently participate in determining the size of the view. This method is deprecated. Use {link #setHint(int, String)} or {link #setHint(CharSequence, String)} instead.
Sets the text to be displayed when the text of the TextView is empty, from a resource. This method is deprecated. Use {link #setHint(int, String)} or {link #setHint(CharSequence, String)} instead.
Sets the color of the hint text.
Sets the color of the hint text.
Sets whether the text should be allowed to be wider than the View is. If false, it will be wrapped to the width of the View.
Change the custom IME action associated with the text view, which will be reported to an IME with actionLabel and actionId when it has focus.
Change the editor type integer associated with the text view, which will be reported to an IME with imeOptions when it has focus.
Set whether the TextView includes extra top and bottom padding to make room for accents that go above the normal ascent and descent. The default is true.
Set the extra input data of the text, which is the TextBoxAttribute.extras Bundle that will be filled in when creating an input connection. The given integer is the resource ID of an XML resource holding an <input-extras> XML tree.
Set the type of the content with a constant as defined for inputType. This will take care of changing the key listener, by calling setKeyListener(KeyListener), to match the given content type. If the given content type is TYPE_NULL then a soft keyboard will not be displayed for this text view.
Sets the key listener to be used with this TextView. This can be null to disallow user input. Note that this method has significant and subtle interactions with soft keyboards and other input method: see KeyListener.getContentType() for important details. Calling this method will replace the current content type of the text view with the content type returned by the key listener.
Be warned that if you want a TextView with a key listener or movement method not to be focusable, or if you want a TextView without a key listener or movement method to be focusable, you must call setFocusable(boolean) again after calling this to get the focusability back the way you want it.
Sets line spacing for this TextView. Each line will have its height
multiplied by mult
and have add
added to it.
Makes the TextView exactly this many lines tall
Sets the color of links in the text.
Sets the color of links in the text.
Sets whether the movement method will automatically be set to LinkMovementMethod if setAutoLinkMask(int) has been set to nonzero and links are detected in setText(char[], int, int). The default is true.
Sets how many times to repeat the marquee animation. Only applied if the TextView has marquee enabled. Set to -1 to repeat indefinitely.
Makes the TextView at most this many ems wide
Makes the TextView at most this many pixels tall
Makes the TextView at most this many lines tall
Makes the TextView at most this many pixels wide
Makes the TextView at least this many ems wide
Makes the TextView at least this many pixels tall
Makes the TextView at least this many lines tall
Makes the TextView at least this many pixels wide
Sets the movement method (arrow key handler) to be used for this TextView. This can be null to disallow using the arrow keys to move the cursor or scroll the view.
Be warned that if you want a TextView with a key listener or movement method not to be focusable, or if you want a TextView without a key listener or movement method to be focusable, you must call setFocusable(boolean) again after calling this to get the focusability back the way you want it.
Set a special listener to be called when an action is performed on the text view. This will be called when the enter key is pressed, or when an action supplied to the IME is selected by the user. Setting this means that the normal hard key event will not insert a newline into the text view, even if it is multi-line; holding down the ALT modifier will, however, allow the user to insert a newline character.
Sets the padding. The view may add on the space required to display the scrollbars, depending on the style and visibility of the scrollbars. So the values returned from getPaddingLeft(), getPaddingTop(), getPaddingRight() and getPaddingBottom() may be different from the values set in this call.
left | the left padding in pixels |
---|---|
top | the top padding in pixels |
right | the right padding in pixels |
bottom | the bottom padding in pixels |
Sets flags on the Paint being used to display the text and reflows the text if they are different from the old flags.
Set the private content type of the text, which is the EditorInfo.privateImeOptions field that will be filled in when creating an input connection.
Directly change the content type integer of the text view, without modifying any other state.
Set the TextView so that when it takes focus, all the text is selected.
Changes the selection state of this view. A view can be selected or not. Note that selection is not the same as focus. Views are typically selected in the context of an AdapterView like ListView or GridView; the selected view is the view that is highlighted.
selected | true if the view must be selected, false otherwise |
---|
Gives the text a shadow of the specified radius and color, the specified distance from its normal position.
Sets the properties of this field (lines, horizontally scrolling, transformation method) to be for a single-line input.
If true, sets the properties of this field (lines, horizontally scrolling, transformation method) to be for a single-line input; if false, restores these to the default conditions. Note that calling this with false restores default conditions, not necessarily those that were in effect prior to calling it with true.
Sets the Factory used to create new Spannables.
Sets the TextView to display the specified slice of the specified char array. You must promise that you will not change the contents of the array except for right before another call to setText(), since the TextView has no way to know that the text has changed and that it needs to invalidate and re-layout.
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.
Sets the string value of the TextView. TextView does not accept HTML-like formatting, which you can do with text strings in XML resource files. To style your strings, attach android.text.style.* objects to a SpannableString, or see the Available Resource Types documentation for an example of setting formatted text in the XML resource file.
Sets the text color, size, style, hint color, and highlight color from the specified TextAppearance resource.
Sets the text color for all the states (normal, selected, focused) to be this color.
Sets the text color.
Like setText(CharSequence), except that the cursor position (if any) is retained in the new text.
text | The new text to place in the text view. |
---|
Like setText(CharSequence, android.widget.TextView.BufferType), except that the cursor position (if any) is retained in the new text.
Sets the extent by which text should be stretched horizontally.
Set the default text size to a given unit and value. See TypedValue for the possible dimension units.
unit | The desired dimension unit. |
---|---|
size | The desired size in the given units. |
Set the default text size to the given value, interpreted as "scaled pixel" units. This size is adjusted based on the current density and user font size preference.
size | The scaled pixel size. |
---|
Sets the transformation that is applied to the text that this TextView is displaying.
Sets the typeface and style in which the text should be displayed, and turns on the fake bold and italic bits in the Paint if the Typeface that you provided does not have all the bits in the style that you specified.
Sets the typeface and style in which the text should be displayed. Note that not all Typeface families actually have bold and italic variants, so you may need to use setTypeface(Typeface, int) to get the appearance that you actually want.
Makes the TextView exactly this many pixels wide. You could do the same thing by specifying this number in the LayoutParams.
Compute the horizontal range that the horizontal scrollbar represents.
The range is expressed in arbitrary units that must be the same as the units used by computeHorizontalScrollExtent() and computeHorizontalScrollOffset().
The default range is the drawing width of this view.
Compute the vertical extent of the horizontal scrollbar's thumb within the vertical range. This value is used to compute the length of the thumb within the scrollbar's track.
The range is expressed in arbitrary units that must be the same as the units used by computeHorizontalScrollRange() and computeVerticalScrollOffset().
The default extent is the drawing height of this view.
Compute the vertical range that the vertical scrollbar represents.
The range is expressed in arbitrary units that must be the same as the units used by computeVerticalScrollExtent() and computeVerticalScrollOffset().
The default range is the drawing height of this view.
This function is called whenever the state of the view changes in such a way that it impacts the state of drawables being shown.
Be sure to call through to the superclass when overriding this function.
Amount by which to extend the bottom fading region. Called only when isPaddingOffsetRequired() returns true.
Subclasses override this to specify that they have a KeyListener by default even if not specifically called for in the XML options.
Subclasses override this to specify a default movement method.
Returns the strength, or intensity, of the left faded edge. The strength is a value between 0.0 (no fade) and 1.0 (full fade). The default implementation returns 0.0 or 1.0 but no value in between. Subclasses should override this method to provide a smoother fade transition when scrolling occurs.
Amount by which to extend the left fading region. Called only when isPaddingOffsetRequired() returns true.
Returns the strength, or intensity, of the right faded edge. The strength is a value between 0.0 (no fade) and 1.0 (full fade). The default implementation returns 0.0 or 1.0 but no value in between. Subclasses should override this method to provide a smoother fade transition when scrolling occurs.
Amount by which to extend the right fading region. Called only when isPaddingOffsetRequired() returns true.
Amount by which to extend the top fading region. Called only when isPaddingOffsetRequired() returns true.
If the View draws content inside its padding and enables fading edges, it needs to support padding offsets. Padding offsets are added to the fading edges to extend the length of the fade so that it covers pixels drawn inside the padding. Subclasses of this class should override this method if they need to draw content inside the padding.
This is called when the view is attached to a window. At this point it has a Surface and will start drawing. Note that this function is guaranteed to be called before onDraw(Canvas), however it may be called any time before the first onDraw -- including before or after onMeasure(int, int).
Views should implement this if the view itself is going to add items to the context menu.
menu | the context menu to populate |
---|
This is called when the view is detached from a window. At this point it no longer has a surface for drawing.
Implement this to do your drawing.
canvas | the canvas on which the background will be drawn |
---|
Called by the view system when the focus state of this view changes. When the focus change event is caused by directional navigation, direction and previouslyFocusedRect provide insight into where the focus is coming from. When overriding, be sure to call up through to the super class so that the standard focus handling will occur.
focused | True if the View has focus; false otherwise. |
---|---|
direction | The direction focus has moved when requestFocus() is called to give this view focus. Values are View.FOCUS_UP, View.FOCUS_DOWN, View.FOCUS_LEFT or View.FOCUS_RIGHT. It may not always apply, in which case use the default. |
previouslyFocusedRect | The rectangle, in this view's coordinate
system, of the previously focused view. If applicable, this will be
passed in as finer grained information about where the focus is coming
from (in addition to direction). Will be null otherwise.
|
Measure the view and its content to determine the measured width and the measured height. This method is invoked by measure(int, int) and should be overriden by subclasses to provide accurate and efficient measurement of their contents.
CONTRACT: When overriding this method, you
must call setMeasuredDimension(int, int) to store the
measured width and height of this view. Failure to do so will trigger an
IllegalStateException
, thrown by
measure(int, int). Calling the superclass'
onMeasure(int, int) is a valid use.
The base class implementation of measure defaults to the background size, unless a larger size is allowed by the MeasureSpec. Subclasses should override onMeasure(int, int) to provide better measurements of their content.
If this method is overridden, it is the subclass's responsibility to make sure the measured height and width are at least the view's minimum height and width (getSuggestedMinimumHeight() and getSuggestedMinimumWidth()).
widthMeasureSpec | horizontal space requirements as imposed by the parent. The requirements are encoded with View.MeasureSpec. |
---|---|
heightMeasureSpec | vertical space requirements as imposed by the parent. The requirements are encoded with View.MeasureSpec. |
This method is called when the selection has changed, in case any subclasses would like to know.
selStart | The new selection start location. |
---|---|
selEnd | The new selection end location. |
This method is called when the text is changed, in case any subclasses would like to know.
text | The text the TextView is displaying. |
---|---|
start | The offset of the start of the range of the text that was modified. |
before | The offset of the former end of the range of the
text that was modified. If text was simply inserted,
this will be the same as start .
If text was replaced with new text or deleted, the
length of the old text was before-start . |
after | The offset of the end of the range of the text
that was modified. If text was simply deleted,
this will be the same as start .
If text was replaced with new text or inserted,
the length of the new text is after-start .
|
Assign a size and position to this view. This is called from layout.
l | Left position, relative to parent |
---|---|
t | Top position, relative to parent |
r | Right position, relative to parent |
b | Bottom position, relative to parent |
If your view subclass is displaying its own Drawable objects, it should override this function and return true for any Drawable it is displaying. This allows animations for those drawables to be scheduled.
Be sure to call through to the super class when overriding this function.
who | The Drawable to verify. Return true if it is one you are displaying, else return the result of calling through to the super class. |
---|