IT. Expert System.

Android Reference

TextView


android.widget

Class TextView

    • Method Detail

      • setEnabled

        public void setEnabled(boolean enabled)
        Description copied from class: View
        Set the enabled state of this view. The interpretation of the enabled state varies by subclass.
        Overrides:
        setEnabled in class View
        Parameters:
        enabled - True if this view is enabled, false otherwise.
      • setTypeface

        public void setTypeface(Typeface tf,
                       int style)
        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.
      • getDefaultEditable

        protected boolean getDefaultEditable()
        Subclasses override this to specify that they have a KeyListener by default even if not specifically called for in the XML options.
      • getDefaultMovementMethod

        protected MovementMethod getDefaultMovementMethod()
        Subclasses override this to specify a default movement method.
      • getText

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

        public int length()
        Returns the length, in characters, of the text managed by this TextView
      • getEditableText

        public Editable getEditableText()
        Return the text the TextView is displaying as an Editable object. If the text is not editable, null is returned.
        See Also:
        getText()
      • getLineHeight

        public int getLineHeight()
        Returns:
        the height of one standard line in pixels. Note that markup within the text can cause individual lines to be taller or shorter than this height, and the layout may contain additional first- or last-line padding.
      • getLayout

        public final Layout getLayout()
        Returns:
        the Layout that is currently being used to display the text. This can be null if the text or width has recently changes.
      • getKeyListener

        public final KeyListener getKeyListener()
        Returns:
        the current key listener for this TextView. This will frequently be null for non-EditText TextViews.
      • setKeyListener

        public void setKeyListener(KeyListener input)
        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 View.setFocusable(boolean) again after calling this to get the focusability back the way you want it.

      • getMovementMethod

        public final MovementMethod getMovementMethod()
        Returns:
        the movement method being used for this TextView. This will frequently be null for non-EditText TextViews.
      • setMovementMethod

        public final void setMovementMethod(MovementMethod movement)
        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 View.setFocusable(boolean) again after calling this to get the focusability back the way you want it.

      • getTransformationMethod

        public final TransformationMethod getTransformationMethod()
        Returns:
        the current transformation method for this TextView. This will frequently be null except for single-line and password fields.
      • setTransformationMethod

        public final void setTransformationMethod(TransformationMethod method)
        Sets the transformation that is applied to the text that this TextView is displaying.
      • getCompoundPaddingTop

        public int getCompoundPaddingTop()
        Returns the top padding of the view, plus space for the top Drawable if any.
      • getCompoundPaddingBottom

        public int getCompoundPaddingBottom()
        Returns the bottom padding of the view, plus space for the bottom Drawable if any.
      • getCompoundPaddingLeft

        public int getCompoundPaddingLeft()
        Returns the left padding of the view, plus space for the left Drawable if any.
      • getCompoundPaddingRight

        public int getCompoundPaddingRight()
        Returns the right padding of the view, plus space for the right Drawable if any.
      • getCompoundPaddingStart

        public int getCompoundPaddingStart()
        Returns the start padding of the view, plus space for the start Drawable if any.
      • getCompoundPaddingEnd

        public int getCompoundPaddingEnd()
        Returns the end padding of the view, plus space for the end Drawable if any.
      • getExtendedPaddingTop

        public int getExtendedPaddingTop()
        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.
      • getExtendedPaddingBottom

        public int getExtendedPaddingBottom()
        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.
      • getTotalPaddingLeft

        public int getTotalPaddingLeft()
        Returns the total left padding of the view, including the left Drawable if any.
      • getTotalPaddingRight

        public int getTotalPaddingRight()
        Returns the total right padding of the view, including the right Drawable if any.
      • getTotalPaddingStart

        public int getTotalPaddingStart()
        Returns the total start padding of the view, including the start Drawable if any.
      • getTotalPaddingEnd

        public int getTotalPaddingEnd()
        Returns the total end padding of the view, including the end Drawable if any.
      • getTotalPaddingTop

        public int getTotalPaddingTop()
        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.
      • getTotalPaddingBottom

        public int getTotalPaddingBottom()
        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.
      • setCompoundDrawablesWithIntrinsicBounds

        public void setCompoundDrawablesWithIntrinsicBounds(int left,
                                                   int top,
                                                   int right,
                                                   int bottom)
        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.
        Parameters:
        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.
      • setCompoundDrawablesWithIntrinsicBounds

        public void setCompoundDrawablesWithIntrinsicBounds(Drawable left,
                                                   Drawable top,
                                                   Drawable right,
                                                   Drawable bottom)
        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.
      • setCompoundDrawablesRelative

        public void setCompoundDrawablesRelative(Drawable start,
                                        Drawable top,
                                        Drawable end,
                                        Drawable bottom)
        Sets the Drawables (if any) to appear to the start of, above, to the end of, and below the text. Use null if you do not want a Drawable there. The Drawables must already have had Drawable.setBounds(int, int, int, int) called.
      • setCompoundDrawablesRelativeWithIntrinsicBounds

        public void setCompoundDrawablesRelativeWithIntrinsicBounds(int start,
                                                           int top,
                                                           int end,
                                                           int bottom)
        Sets the Drawables (if any) to appear to the start of, above, to the end 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.
        Parameters:
        start - Resource identifier of the start Drawable.
        top - Resource identifier of the top Drawable.
        end - Resource identifier of the end Drawable.
        bottom - Resource identifier of the bottom Drawable.
      • setCompoundDrawablesRelativeWithIntrinsicBounds

        public void setCompoundDrawablesRelativeWithIntrinsicBounds(Drawable start,
                                                           Drawable top,
                                                           Drawable end,
                                                           Drawable bottom)
        Sets the Drawables (if any) to appear to the start of, above, to the end 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.
      • getCompoundDrawables

        public Drawable[] getCompoundDrawables()
        Returns drawables for the left, top, right, and bottom borders.
      • getCompoundDrawablesRelative

        public Drawable[] getCompoundDrawablesRelative()
        Returns drawables for the start, top, end, and bottom borders.
      • setCompoundDrawablePadding

        public void setCompoundDrawablePadding(int pad)
        Sets the size of the padding between the compound drawables and the text.
      • getCompoundDrawablePadding

        public int getCompoundDrawablePadding()
        Returns the padding between the compound drawables and the text.
      • setPadding

        public void setPadding(int left,
                      int top,
                      int right,
                      int bottom)
        Description copied from class: View
        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 View.getPaddingLeft(), View.getPaddingTop(), View.getPaddingRight() and View.getPaddingBottom() may be different from the values set in this call.
        Overrides:
        setPadding in class View
        Parameters:
        left - the left padding in pixels
        top - the top padding in pixels
        right - the right padding in pixels
        bottom - the bottom padding in pixels
      • setPaddingRelative

        public void setPaddingRelative(int start,
                              int top,
                              int end,
                              int bottom)
        Description copied from class: View
        Sets the relative 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 View.getPaddingStart(), View.getPaddingTop(), View.getPaddingEnd() and View.getPaddingBottom() may be different from the values set in this call.
        Overrides:
        setPaddingRelative in class View
        Parameters:
        start - the start padding in pixels
        top - the top padding in pixels
        end - the end padding in pixels
        bottom - the bottom padding in pixels
      • getAutoLinkMask

        public final int getAutoLinkMask()
        Gets the autolink mask of the text. See Linkify.ALL and peers for possible values.
      • setTextAppearance

        public void setTextAppearance(Context context,
                             int resid)
        Sets the text color, size, style, hint color, and highlight color from the specified TextAppearance resource.
      • getTextLocale

        public Locale getTextLocale()
        Get the default Locale of the text in this TextView.
        Returns:
        the default Locale of the text in this TextView.
      • setTextLocale

        public void setTextLocale(Locale locale)
        Set the default Locale of the text in this TextView to the given value. This value is used to choose appropriate typefaces for ambiguous characters. Typically used for CJK locales to disambiguate Hanzi/Kanji/Hanja characters.
        Parameters:
        locale - the Locale for drawing text, must not be null.
        See Also:
        Paint.setTextLocale(java.util.Locale)
      • getTextSize

        public float getTextSize()
        Returns:
        the size (in pixels) of the default text size in this TextView.
      • setTextSize

        public void setTextSize(float size)
        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.
        Parameters:
        size - The scaled pixel size.
      • setTextSize

        public void setTextSize(int unit,
                       float size)
        Set the default text size to a given unit and value. See TypedValue for the possible dimension units.
        Parameters:
        unit - The desired dimension unit.
        size - The desired size in the given units.
      • getTextScaleX

        public float getTextScaleX()
        Returns:
        the extent by which text is currently being stretched horizontally. This will usually be 1.
      • setTextScaleX

        public void setTextScaleX(float size)
        Sets the extent by which text should be stretched horizontally.
      • setTypeface

        public void setTypeface(Typeface tf)
        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.
        See Also:
        getTypeface()
      • getTypeface

        public Typeface getTypeface()
        Returns:
        the current typeface and style in which the text is being displayed.
        See Also:
        setTypeface(Typeface)
      • getCurrentTextColor

        public final int getCurrentTextColor()

        Return the current color selected for normal text.

        Returns:
        Returns the current text color.
      • setHighlightColor

        public void setHighlightColor(int color)
        Sets the color used to display the selection highlight.
      • getHighlightColor

        public int getHighlightColor()
        Returns:
        the color used to display the selection highlight
        See Also:
        setHighlightColor(int)
      • setShowSoftInputOnFocus

        public final void setShowSoftInputOnFocus(boolean show)
        Sets whether the soft input method will be made visible when this TextView gets focused. The default is true.
      • getShowSoftInputOnFocus

        public final boolean getShowSoftInputOnFocus()
        Returns whether the soft input method will be made visible when this TextView gets focused. The default is true.
      • setShadowLayer

        public void setShadowLayer(float radius,
                          float dx,
                          float dy,
                          int color)
        Gives the text a shadow of the specified radius and color, the specified distance from its normal position.
      • getShadowRadius

        public float getShadowRadius()
        Gets the radius of the shadow layer.
        Returns:
        the radius of the shadow layer. If 0, the shadow layer is not visible
        See Also:
        setShadowLayer(float, float, float, int)
      • getPaint

        public TextPaint getPaint()
        Returns:
        the base paint used for the text. Please use this only to consult the Paint's properties and not to change them.
      • setAutoLinkMask

        public final void setAutoLinkMask(int mask)
        Sets the autolink mask of the text. See Linkify.ALL and peers for possible values.
      • getCurrentHintTextColor

        public final int getCurrentHintTextColor()

        Return the current color selected to paint the hint text.

        Returns:
        Returns the current hint text color.
      • setGravity

        public void setGravity(int gravity)
        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.
        See Also:
        Gravity
      • getGravity

        public int getGravity()
        Returns the horizontal and vertical alignment of this TextView.
        See Also:
        Gravity
      • getPaintFlags

        public int getPaintFlags()
        Returns:
        the flags on the Paint being used to display the text.
        See Also:
        Paint.getFlags()
      • setPaintFlags

        public void setPaintFlags(int flags)
        Sets flags on the Paint being used to display the text and reflows the text if they are different from the old flags.
        See Also:
        Paint.setFlags(int)
      • setHorizontallyScrolling

        public void setHorizontallyScrolling(boolean whether)
        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.
      • getHorizontallyScrolling

        public boolean getHorizontallyScrolling()
        Returns whether the text is allowed to be wider than the View is. If false, the text will be wrapped to the width of the View.
      • setMinLines

        public void setMinLines(int minlines)
        Makes the TextView at least this many lines tall. Setting this value overrides any other (minimum) height setting. A single line TextView will set this value to 1.
        See Also:
        getMinLines()
      • getMinLines

        public int getMinLines()
        Returns:
        the minimum number of lines displayed in this TextView, or -1 if the minimum height was set in pixels instead using or #setHeight(int).
        See Also:
        setMinLines(int)
      • setMinHeight

        public void setMinHeight(int minHeight)
        Makes the TextView at least this many pixels tall. Setting this value overrides any other (minimum) number of lines setting.
      • getMinHeight

        public int getMinHeight()
        Returns:
        the minimum height of this TextView expressed in pixels, or -1 if the minimum height was set in number of lines instead using or #setLines(int).
        See Also:
        setMinHeight(int)
      • setMaxLines

        public void setMaxLines(int maxlines)
        Makes the TextView at most this many lines tall. Setting this value overrides any other (maximum) height setting.
      • getMaxLines

        public int getMaxLines()
        Returns:
        the maximum number of lines displayed in this TextView, or -1 if the maximum height was set in pixels instead using or #setHeight(int).
        See Also:
        setMaxLines(int)
      • setMaxHeight

        public void setMaxHeight(int maxHeight)
        Makes the TextView at most this many pixels tall. This option is mutually exclusive with the setMaxLines(int) method. Setting this value overrides any other (maximum) number of lines setting.
      • getMaxHeight

        public int getMaxHeight()
        Returns:
        the maximum height of this TextView expressed in pixels, or -1 if the maximum height was set in number of lines instead using or #setLines(int).
        See Also:
        setMaxHeight(int)
      • setLines

        public void setLines(int lines)
        Makes the TextView exactly this many lines tall. Note that setting this value overrides any other (minimum / maximum) number of lines or height setting. A single line TextView will set this value to 1.
      • setHeight

        public void setHeight(int pixels)
        Makes the TextView exactly this many pixels tall. You could do the same thing by specifying this number in the LayoutParams. Note that setting this value overrides any other (minimum / maximum) number of lines or height setting.
      • setMinEms

        public void setMinEms(int minems)
        Makes the TextView at least this many ems wide
      • setMinWidth

        public void setMinWidth(int minpixels)
        Makes the TextView at least this many pixels wide
      • setMaxEms

        public void setMaxEms(int maxems)
        Makes the TextView at most this many ems wide
      • setMaxWidth

        public void setMaxWidth(int maxpixels)
        Makes the TextView at most this many pixels wide
      • setLineSpacing

        public void setLineSpacing(float add,
                          float mult)
        Sets line spacing for this TextView. Each line will have its height multiplied by mult and have add added to it.
      • getLineSpacingMultiplier

        public float getLineSpacingMultiplier()
        Gets the line spacing multiplier
        Returns:
        the value by which each line's height is multiplied to get its actual height.
        See Also:
        setLineSpacing(float, float), getLineSpacingExtra()
      • append

        public final void append(CharSequence text)
        Convenience method: Append the specified text to the TextView's display buffer, upgrading it to BufferType.EDITABLE if it was not already editable.
      • append

        public void append(CharSequence text,
                  int start,
                  int end)
        Convenience method: Append the specified text slice to the TextView's display buffer, upgrading it to BufferType.EDITABLE if it was not already editable.
      • drawableStateChanged

        protected void drawableStateChanged()
        Description copied from class: 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.

        Overrides:
        drawableStateChanged in class View
        See Also:
        Drawable.setState(int[])
      • onSaveInstanceState

        public Parcelable onSaveInstanceState()
        Description copied from class: View
        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.

        Overrides:
        onSaveInstanceState in class View
        Returns:
        Returns a Parcelable object containing the view's current dynamic state, or null if there is nothing interesting to save. The default implementation returns null.
        See Also:
        View.onRestoreInstanceState(android.os.Parcelable), View.saveHierarchyState(android.util.SparseArray), View.dispatchSaveInstanceState(android.util.SparseArray), View.setSaveEnabled(boolean)
      • setFreezesText

        public void setFreezesText(boolean freezesText)
        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.
        Parameters:
        freezesText - Controls whether a frozen icicle should include the entire text data: true to include it, false to not.
      • getFreezesText

        public boolean getFreezesText()
        Return whether this text view is including its entire text contents in frozen icicles.
        Returns:
        Returns true if text is included, false if it isn't.
        See Also:
        setFreezesText(boolean)
      • setEditableFactory

        public final void setEditableFactory(Editable.Factory factory)
        Sets the Factory used to create new Editables.
      • setSpannableFactory

        public final void setSpannableFactory(Spannable.Factory factory)
        Sets the Factory used to create new Spannables.
      • setText

        public final void setText(CharSequence text)
        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.
      • setText

        public final void setText(char[] text,
                   int start,
                   int len)
        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.
      • setText

        public final void setText(int resid)
      • setHint

        public final void setHint(CharSequence hint)
        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.
      • setHint

        public final void setHint(int resid)
        Sets the text to be displayed when the text of the TextView is empty, from a resource.
      • getHint

        public CharSequence getHint()
        Returns the hint that is displayed when the text of the TextView is empty.
      • setRawInputType

        public void setRawInputType(int type)
        Directly change the content type integer of the text view, without modifying any other state.
        See Also:
        setInputType(int), InputType
      • setImeOptions

        public void setImeOptions(int imeOptions)
        Change the editor type integer associated with the text view, which will be reported to an IME with EditorInfo.imeOptions when it has focus.
        See Also:
        getImeOptions(), EditorInfo
      • setOnEditorActionListener

        public void setOnEditorActionListener(TextView.OnEditorActionListener l)
        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.
      • getInputExtras

        public Bundle getInputExtras(boolean create)
        Retrieve the input extras currently associated with the text view, which can be viewed as well as modified.
        Parameters:
        create - If true, the extras will be created if they don't already exist. Otherwise, null will be returned if none have been created.
        See Also:
        setInputExtras(int), EditorInfo.extras
      • getError

        public CharSequence getError()
        Returns the error message that was set to be displayed with setError(java.lang.CharSequence), or null if no error was set or if it the error was cleared by the widget after user input.
      • setError

        public void setError(CharSequence error)
        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.
      • setError

        public void setError(CharSequence error,
                    Drawable icon)
        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 Drawable.setBounds(int, int, int, int) set on it. If the error is null, the error message will be cleared (and you should provide a null icon as well).
      • setFrame

        protected boolean setFrame(int l,
                       int t,
                       int r,
                       int b)
        Description copied from class: View
        Assign a size and position to this view. This is called from layout.
        Overrides:
        setFrame in class View
        Parameters:
        l - Left position, relative to parent
        t - Top position, relative to parent
        r - Right position, relative to parent
        b - Bottom position, relative to parent
        Returns:
        true if the new size and position are different than the previous ones
      • setFilters

        public void setFilters(InputFilter[] filters)
        Sets the list of input filters that will be used if the buffer is Editable. Has no effect otherwise.
      • getFilters

        public InputFilter[] getFilters()
        Returns the current list of input filters.
      • onDetachedFromWindow

        protected void onDetachedFromWindow()
        Description copied from class: View
        This is called when the view is detached from a window. At this point it no longer has a surface for drawing.
        Overrides:
        onDetachedFromWindow in class View
        See Also:
        View.onAttachedToWindow()
      • onScreenStateChanged

        public void onScreenStateChanged(int screenState)
        Description copied from class: View
        This method is called whenever the state of the screen this view is attached to changes. A state change will usually occurs when the screen turns on or off (whether it happens automatically or the user does it manually.)
        Overrides:
        onScreenStateChanged in class View
        Parameters:
        screenState - The new state of the screen. Can be either View.SCREEN_STATE_ON or View.SCREEN_STATE_OFF
      • verifyDrawable

        protected boolean verifyDrawable(Drawable who)
        Description copied from class: 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. This allows animations for those drawables to be scheduled.

        Be sure to call through to the super class when overriding this function.

        Overrides:
        verifyDrawable in class View
        Parameters:
        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.
        Returns:
        boolean If true than the Drawable is being displayed in the view; else false and it is not allowed to animate.
        See Also:
        View.unscheduleDrawable(android.graphics.drawable.Drawable), View.drawableStateChanged()
      • hasOverlappingRendering

        public boolean hasOverlappingRendering()
        Description copied from class: View
        Returns whether this View has content which overlaps. This function, intended to be overridden by specific View types, is an optimization when alpha is set on a view. If rendering overlaps in a view with alpha < 1, that view is drawn to an offscreen buffer and then composited it into place, which can be expensive. if the view has no overlapping rendering, the view can draw each primitive with the appropriate alpha value directly. an example of overlapping rendering is a textview with a background image, such as a button. an example of non-overlapping rendering is a textview with no background, or an imageview with only the foreground image. the default implementation returns true; subclasses should override if they have cases which can be optimized.
        Overrides:
        hasOverlappingRendering in class View
        Returns:
        true if the content in this view might overlap, false otherwise.
      • isTextSelectable

        public boolean isTextSelectable()
        When a TextView is used to display a useful piece of information to the user (such as a contact's address), it should be made selectable, so that the user can select and copy this content. Use setTextIsSelectable(boolean) or the android.R.styleable#TextView_textIsSelectable XML attribute to make this TextView selectable (text is not selectable by default). Note that this method simply returns the state of this flag. Although this flag has to be set in order to select text in non-editable TextView, the content of an EditText can always be selected, independently of the value of this flag.
        Returns:
        True if the text displayed in this TextView can be selected by the user.
      • onCreateDrawableState

        protected int[] onCreateDrawableState(int extraSpace)
        Description copied from class: View
        Generate the new Drawable state for this view. This is called by the view system when the cached Drawable state is determined to be invalid. To retrieve the current state, you should use View.getDrawableState().
        Overrides:
        onCreateDrawableState in class View
        Parameters:
        extraSpace - if non-zero, this is the number of extra entries you would like in the returned array in which you can place your own states.
        Returns:
        Returns an array holding the current Drawable state of the view.
        See Also:
        View.mergeDrawableStates(int[], int[])
      • onDraw

        protected void onDraw(Canvas canvas)
        Description copied from class: View
        Implement this to do your drawing.
        Overrides:
        onDraw in class View
        Parameters:
        canvas - the canvas on which the background will be drawn
      • getFocusedRect

        public void getFocusedRect(Rect r)
        Description copied from class: View
        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 rectangle is the View.getDrawingRect(android.graphics.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.
        Overrides:
        getFocusedRect in class View
        Parameters:
        r - The rectangle to fill in, in this view's coordinates.
      • getLineCount

        public int getLineCount()
        Return the number of lines of text, or 0 if the internal Layout has not been built.
      • getLineBounds

        public int getLineBounds(int line,
                        Rect bounds)
        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)
        Parameters:
        line - which line to examine (0..getLineCount() - 1)
        bounds - Optional. If not null, it returns the extent of the line
        Returns:
        the Y-coordinate of the baseline
      • getBaseline

        public int getBaseline()
        Description copied from class: View

        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.

        Overrides:
        getBaseline in class View
        Returns:
        the offset of the baseline within the widget's bounds or -1 if baseline alignment is not supported
      • getFadeTop

        protected int getFadeTop(boolean offsetRequired)
        Overrides:
        getFadeTop in class View
      • getFadeHeight

        protected int getFadeHeight(boolean offsetRequired)
        Overrides:
        getFadeHeight in class View
      • onKeyPreIme

        public boolean onKeyPreIme(int keyCode,
                          KeyEvent event)
        Description copied from class: View
        Handle a key event before it is processed by any input method associated with the view hierarchy. This can be used to intercept key events in special situations before the IME consumes them; a typical example would be handling the BACK key to update the application's UI instead of allowing the IME to see it and close itself.
        Overrides:
        onKeyPreIme in class View
        Parameters:
        keyCode - The value in event.getKeyCode().
        event - Description of the key event.
        Returns:
        If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false.
      • onKeyDown

        public boolean onKeyDown(int keyCode,
                        KeyEvent event)
        Description copied from class: View
        Default implementation of KeyEvent.Callback.onKeyDown(): perform press of the view when KeyEvent.KEYCODE_DPAD_CENTER or KeyEvent.KEYCODE_ENTER is released, if the view is enabled and clickable.

        Key presses in software keyboards will generally NOT trigger this listener, although some may elect to do so in some situations. Do not rely on this to catch software key presses.

        Specified by:
        onKeyDown in interface KeyEvent.Callback
        Overrides:
        onKeyDown in class View
        Parameters:
        keyCode - A key code that represents the button pressed, from KeyEvent.
        event - The KeyEvent object that defines the button action.
        Returns:
        If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false.
      • onKeyMultiple

        public boolean onKeyMultiple(int keyCode,
                            int repeatCount,
                            KeyEvent event)
        Description copied from class: View
        Default implementation of KeyEvent.Callback.onKeyMultiple(): always returns false (doesn't handle the event).

        Key presses in software keyboards will generally NOT trigger this listener, although some may elect to do so in some situations. Do not rely on this to catch software key presses.

        Specified by:
        onKeyMultiple in interface KeyEvent.Callback
        Overrides:
        onKeyMultiple in class View
        Parameters:
        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.
        Returns:
        If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false.
      • resetErrorChangedFlag

        public void resetErrorChangedFlag()
        Resets the mErrorWasChanged flag, so that future calls to setError(CharSequence) can be recorded.
      • hideErrorIfUnchanged

        public void hideErrorIfUnchanged()
      • onKeyUp

        public boolean onKeyUp(int keyCode,
                      KeyEvent event)
        Description copied from class: View
        Default implementation of KeyEvent.Callback.onKeyUp(): perform clicking of the view when KeyEvent.KEYCODE_DPAD_CENTER or KeyEvent.KEYCODE_ENTER is released.

        Key presses in software keyboards will generally NOT trigger this listener, although some may elect to do so in some situations. Do not rely on this to catch software key presses.

        Specified by:
        onKeyUp in interface KeyEvent.Callback
        Overrides:
        onKeyUp in class View
        Parameters:
        keyCode - A key code that represents the button pressed, from KeyEvent.
        event - The KeyEvent object that defines the button action.
        Returns:
        If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false.
      • onCheckIsTextEditor

        public boolean onCheckIsTextEditor()
        Description copied from class: View
        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 View.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 View.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.

        Overrides:
        onCheckIsTextEditor in class View
        Returns:
        Returns true if this view is a text editor, else false.
      • onCreateInputConnection

        public InputConnection onCreateInputConnection(EditorInfo outAttrs)
        Description copied from class: View
        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 View.onCheckIsTextEditor() to indicate you will return a non-null InputConnection.

        Overrides:
        onCreateInputConnection in class View
        Parameters:
        outAttrs - Fill in with attribute information about the connection.
      • extractText

        public boolean extractText(ExtractedTextRequest request,
                          ExtractedText outText)
        If this TextView contains editable content, extract a portion of it based on the information in request in to outText.
        Returns:
        Returns true if the text was successfully extracted, else false.
      • onCommitCompletion

        public void onCommitCompletion(CompletionInfo text)
        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.
        Parameters:
        text - The auto complete text the user has selected.
      • onCommitCorrection

        public void onCommitCorrection(CorrectionInfo info)
        Called by the framework in response to a text auto-correction (such as fixing a typo using a a dictionnary) from the current input method, provided by it calling InputConnection.commitCorrection(android.view.inputmethod.CorrectionInfo) InputConnection.commitCorrection()}. The default implementation flashes the background of the corrected word to provide feedback to the user.
        Parameters:
        info - The auto correct info about the text that was corrected.
      • beginBatchEdit

        public void beginBatchEdit()
      • endBatchEdit

        public void endBatchEdit()
      • onBeginBatchEdit

        public void onBeginBatchEdit()
        Called by the framework in response to a request to begin a batch of edit operations through a call to link beginBatchEdit().
      • onEndBatchEdit

        public void onEndBatchEdit()
        Called by the framework in response to a request to end a batch of edit operations through a call to link endBatchEdit().
      • onPrivateIMECommand

        public boolean onPrivateIMECommand(String action,
                                  Bundle data)
        Called by the framework in response to a private command from the current method, provided by it calling InputConnection.performPrivateCommand().
        Parameters:
        action - The action name of the command.
        data - Any additional data for the command. This may be null.
        Returns:
        Return true if you handled the command, else false.
      • onRtlPropertiesChanged

        public void onRtlPropertiesChanged(int layoutDirection)
        Description copied from class: View
        Called when any RTL property (layout direction or text direction or text alignment) has been changed. Subclasses need to override this method to take care of cached information that depends on the resolved layout direction, or to inform child views that inherit their layout direction. The default implementation does nothing.
        Overrides:
        onRtlPropertiesChanged in class View
        Parameters:
        layoutDirection - the direction of the layout
        See Also:
        View.LAYOUT_DIRECTION_LTR, View.LAYOUT_DIRECTION_RTL
      • makeNewLayout

        protected void makeNewLayout(int wantWidth,
                         int hintWidth,
                         BoringLayout.Metrics boring,
                         BoringLayout.Metrics hintBoring,
                         int ellipsisWidth,
                         boolean bringIntoView)
        The width passed in is now the desired layout width, not the full view width with padding.
      • setIncludeFontPadding

        public void setIncludeFontPadding(boolean includepad)
        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.
        See Also:
        getIncludeFontPadding()
      • getIncludeFontPadding

        public boolean getIncludeFontPadding()
        Gets whether the TextView includes extra top and bottom padding to make room for accents that go above the normal ascent and descent.
        See Also:
        setIncludeFontPadding(boolean)
      • onLayout

        protected void onLayout(boolean changed,
                    int left,
                    int top,
                    int right,
                    int bottom)
        Description copied from class: View
        Called from layout when this view should assign a size and position to each of its children. Derived classes with children should override this method and call layout on each of their children.
        Overrides:
        onLayout in class View
        Parameters:
        changed - This is a new size or position for this view
        left - Left position, relative to parent
        top - Top position, relative to parent
        right - Right position, relative to parent
        bottom - Bottom position, relative to parent
      • bringPointIntoView

        public boolean bringPointIntoView(int offset)
        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.
      • moveCursorToVisibleOffset

        public boolean moveCursorToVisibleOffset()
        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.
        Returns:
        True if the cursor was actually moved, false otherwise.
      • computeScroll

        public void computeScroll()
        Description copied from class: 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.
        Overrides:
        computeScroll in class View
      • debug

        public void debug(int depth)
        Description copied from class: View
        Prints information about this view in the log output, with the tag View.VIEW_LOG_TAG. Each line in the output is preceded with an indentation defined by the depth.
        Overrides:
        debug in class View
        Parameters:
        depth - the indentation level
      • hasSelection

        public boolean hasSelection()
        Return true iff there is a selection inside this text view.
      • setSingleLine

        public void setSingleLine()
        Sets the properties of this field (lines, horizontally scrolling, transformation method) to be for a single-line input.
      • setAllCaps

        public void setAllCaps(boolean allCaps)
        Sets the properties of this field to transform input to ALL CAPS display. This may use a "small caps" formatting if available. This setting will be ignored if this field is editable or selectable. This call replaces the current transformation method. Disabling this will not necessarily restore the previous behavior from before this was enabled.
        See Also:
        setTransformationMethod(TransformationMethod)
      • setSingleLine

        public void setSingleLine(boolean singleLine)
        If true, sets the properties of this field (number of lines, horizontally scrolling, transformation method) to be for a single-line input; if false, restores these to the default conditions. Note that the default conditions are not necessarily those that were in effect prior this method, and you may want to reset these properties to your custom values.
      • setMarqueeRepeatLimit

        public void setMarqueeRepeatLimit(int marqueeLimit)
        Sets how many times to repeat the marquee animation. Only applied if the TextView has marquee enabled. Set to -1 to repeat indefinitely.
        See Also:
        getMarqueeRepeatLimit()
      • getMarqueeRepeatLimit

        public int getMarqueeRepeatLimit()
        Gets the number of times the marquee animation is repeated. Only meaningful if the TextView has marquee enabled.
        Returns:
        the number of times the marquee animation is repeated. -1 if the animation repeats indefinitely
        See Also:
        setMarqueeRepeatLimit(int)
      • getEllipsize

        public TextUtils.TruncateAt getEllipsize()
        Returns where, if anywhere, words that are longer than the view is wide should be ellipsized.
      • setSelectAllOnFocus

        public void setSelectAllOnFocus(boolean selectAllOnFocus)
        Set the TextView so that when it takes focus, all the text is selected.
      • setCursorVisible

        public void setCursorVisible(boolean visible)
        Set whether the cursor is visible. The default is true. Note that this property only makes sense for editable TextView.
        See Also:
        isCursorVisible()
      • isCursorVisible

        public boolean isCursorVisible()
        Returns:
        whether or not the cursor is visible (assuming this TextView is editable)
        See Also:
        setCursorVisible(boolean)
      • onTextChanged

        protected void onTextChanged(CharSequence text,
                         int start,
                         int lengthBefore,
                         int lengthAfter)
        This method is called when the text is changed, in case any subclasses would like to know. Within text, the lengthAfter characters beginning at start have just replaced old text that had length lengthBefore. It is an error to attempt to make changes to text from this callback.
        Parameters:
        text - The text the TextView is displaying
        start - The offset of the start of the range of the text that was modified
        lengthBefore - The length of the former text that has been replaced
        lengthAfter - The length of the replacement modified text
      • onSelectionChanged

        protected void onSelectionChanged(int selStart,
                              int selEnd)
        This method is called when the selection has changed, in case any subclasses would like to know.
        Parameters:
        selStart - The new selection start location.
        selEnd - The new selection end location.
      • removeTextChangedListener

        public void removeTextChangedListener(TextWatcher watcher)
        Removes the specified TextWatcher from the list of those whose methods are called whenever this TextView's text changes.
      • onFocusChanged

        protected void onFocusChanged(boolean focused,
                          int direction,
                          Rect previouslyFocusedRect)
        Description copied from class: View
        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.
        Overrides:
        onFocusChanged in class View
        Parameters:
        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, View.FOCUS_RIGHT, View.FOCUS_FORWARD, or View.FOCUS_BACKWARD. 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.
      • onWindowFocusChanged

        public void onWindowFocusChanged(boolean hasWindowFocus)
        Description copied from class: View
        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.
        Overrides:
        onWindowFocusChanged in class View
        Parameters:
        hasWindowFocus - True if the window containing this view now has focus, false otherwise.
      • onVisibilityChanged

        protected void onVisibilityChanged(View changedView,
                               int visibility)
        Description copied from class: View
        Called when the visibility of the view or an ancestor of the view is changed.
        Overrides:
        onVisibilityChanged in class View
        Parameters:
        changedView - The view whose visibility changed. Could be 'this' or an ancestor view.
        visibility - The new visibility of changedView: View.VISIBLE, View.INVISIBLE or View.GONE.
      • setSelected

        public void setSelected(boolean selected)
        Description copied from class: View
        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.
        Overrides:
        setSelected in class View
        Parameters:
        selected - true if the view must be selected, false otherwise
      • onTouchEvent

        public boolean onTouchEvent(MotionEvent event)
        Description copied from class: View
        Implement this method to handle touch screen motion events.
        Overrides:
        onTouchEvent in class View
        Parameters:
        event - The motion event.
        Returns:
        True if the event was handled, false otherwise.
      • onGenericMotionEvent

        public boolean onGenericMotionEvent(MotionEvent event)
        Description copied from class: View
        Implement this method to handle generic motion events.

        Generic motion events describe joystick movements, mouse hovers, track pad touches, scroll wheel movements and other input events. The source of the motion event specifies the class of input that was received. Implementations of this method must examine the bits in the source before processing the event. The following code example shows how this is done.

        Generic motion events with source class InputDevice.SOURCE_CLASS_POINTER are delivered to the view under the pointer. All other generic motion events are delivered to the focused view.

         public boolean onGenericMotionEvent(MotionEvent event) {
             if ((event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) {
                 if (event.getAction() == MotionEvent.ACTION_MOVE) {
                     // process the joystick movement...
                     return true;
                 }
             }
             if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) {
                 switch (event.getAction()) {
                     case MotionEvent.ACTION_HOVER_MOVE:
                         // process the mouse hover movement...
                         return true;
                     case MotionEvent.ACTION_SCROLL:
                         // process the scroll wheel movement...
                         return true;
                 }
             }
             return super.onGenericMotionEvent(event);
         }
        Overrides:
        onGenericMotionEvent in class View
        Parameters:
        event - The generic motion event being processed.
        Returns:
        True if the event was handled, false otherwise.
      • didTouchFocusSelect

        public boolean didTouchFocusSelect()
        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, in an editable text view.
      • cancelLongPress

        public void cancelLongPress()
        Description copied from class: View
        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.
        Overrides:
        cancelLongPress in class View
      • onTrackballEvent

        public boolean onTrackballEvent(MotionEvent event)
        Description copied from class: View
        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).
        Overrides:
        onTrackballEvent in class View
        Parameters:
        event - The motion event.
        Returns:
        True if the event was handled, false otherwise.
      • setScroller

        public void setScroller(Scroller s)
      • getLeftFadingEdgeStrength

        protected float getLeftFadingEdgeStrength()
        Description copied from class: View
        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.
        Overrides:
        getLeftFadingEdgeStrength in class View
        Returns:
        the intensity of the left fade as a float between 0.0f and 1.0f
      • getRightFadingEdgeStrength

        protected float getRightFadingEdgeStrength()
        Description copied from class: View
        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.
        Overrides:
        getRightFadingEdgeStrength in class View
        Returns:
        the intensity of the right fade as a float between 0.0f and 1.0f
      • getTextColors

        public static ColorStateList getTextColors(Context context,
                                   TypedArray attrs)
        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.
      • getTextColor

        public static int getTextColor(Context context,
                       TypedArray attrs,
                       int def)
        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.
      • onKeyShortcut

        public boolean onKeyShortcut(int keyCode,
                            KeyEvent event)
        Description copied from class: View
        Called on the focused view when a key shortcut event is not handled. Override this method to implement local key shortcuts for the View. Key shortcuts can also be implemented by setting the shortcut property of menu items.
        Overrides:
        onKeyShortcut in class View
        Parameters:
        keyCode - The value in event.getKeyCode().
        event - Description of the key event.
        Returns:
        If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false.
      • getTextServicesLocale

        public Locale getTextServicesLocale()
        This is a temporary method. Future versions may support multi-locale text. Caveat: This method may not return the latest text services locale, but this should be acceptable and it's more important to make this method asynchronous.
        Returns:
        The locale that should be used for a word iterator and a spell checker in this TextView, based on the current spell checker settings, the current IME's locale, or the system default locale.
      • getWordIterator

        public WordIterator getWordIterator()
        This method is used by the ArrowKeyMovementMethod to jump from one word to the other. Made available to achieve a consistent behavior.
      • getTextForAccessibility

        public CharSequence getTextForAccessibility()
        Gets the text reported for accessibility purposes.
        Returns:
        The accessibility text.
      • isInputMethodTarget

        public boolean isInputMethodTarget()
        Returns whether this text view is a current input method target. The default implementation just checks with InputMethodManager.
      • onTextContextMenuItem

        public boolean onTextContextMenuItem(int id)
        Called when a context menu option for the text view is selected. Currently this will be one of android.R.id#selectAll, android.R.id#cut, android.R.id#copy or android.R.id#paste.
        Returns:
        true if the context menu item action was performed.
      • performLongClick

        public boolean performLongClick()
        Description copied from class: View
        Call this view's OnLongClickListener, if it is defined. Invokes the context menu if the OnLongClickListener did not consume the event.
        Overrides:
        performLongClick in class View
        Returns:
        True if one of the above receivers consumed the event, false otherwise.
      • onScrollChanged

        protected void onScrollChanged(int horiz,
                           int vert,
                           int oldHoriz,
                           int oldVert)
        Description copied from class: View
        This is called in response to an internal scroll in this view (i.e., the view scrolled its own contents). This is typically as a result of View.scrollBy(int, int) or View.scrollTo(int, int) having been called.
        Overrides:
        onScrollChanged in class View
        Parameters:
        horiz - Current horizontal scroll origin.
        vert - Current vertical scroll origin.
        oldHoriz - Previous horizontal scroll origin.
        oldVert - Previous vertical scroll origin.
      • setCustomSelectionActionModeCallback

        public void setCustomSelectionActionModeCallback(ActionMode.Callback actionModeCallback)
        If provided, this ActionMode.Callback will be used to create the ActionMode when text selection is initiated in this View. The standard implementation populates the menu with a subset of Select All, Cut, Copy and Paste actions, depending on what this View supports. A custom implementation can add new entries in the default menu in its ActionMode.Callback.onPrepareActionMode(ActionMode, Menu) method. The default actions can also be removed from the menu using Menu.removeItem(int) and passing android.R.id#selectAll, android.R.id#cut, android.R.id#copy or android.R.id#paste ids as parameters. Returning false from ActionMode.Callback.onCreateActionMode(ActionMode, Menu) will prevent the action mode from being started. Action click events should be handled by the custom implementation of ActionMode.Callback.onActionItemClicked(ActionMode, MenuItem). Note that text selection mode is not started when a TextView receives focus and the android.R.attr#selectAllOnFocus flag has been set. The content is highlighted in that case, to allow for quick replacement.
      • stopSelectionActionMode

        protected void stopSelectionActionMode()
      • getOffsetForPosition

        public int getOffsetForPosition(float x,
                               float y)
        Get the character offset closest to the specified absolute position. A typical use case is to pass the result of MotionEvent.getX() and MotionEvent.getY() to this method.
        Parameters:
        x - The horizontal absolute position of a point on screen
        y - The vertical absolute position of a point on screen
        Returns:
        the character offset for the character whose position is closest to the specified position. Returns -1 if there is no layout.
      • onDragEvent

        public boolean onDragEvent(DragEvent event)
        Description copied from class: View
        Handles drag events sent by the system following a call to startDrag().

        When the system calls this method, it passes a DragEvent object. A call to DragEvent.getAction() returns one of the action type constants defined in DragEvent. The method uses these to determine what is happening in the drag and drop operation.

        Overrides:
        onDragEvent in class View
        Parameters:
        event - The DragEvent sent by the system. The DragEvent.getAction() method returns an action type constant defined in DragEvent, indicating the type of drag event represented by this object.
        Returns:
        true if the method was successful, otherwise false.

        The method should return true in response to an action type of DragEvent.ACTION_DRAG_STARTED to receive drag events for the current operation.

        The method should also return true in response to an action type of DragEvent.ACTION_DROP if it consumed the drop, or false if it didn't.

      • deleteText_internal

        protected void deleteText_internal(int start,
                               int end)
        Deletes the range of text [start, end[.
      • replaceText_internal

        protected void replaceText_internal(int start,
                                int end,
                                CharSequence text)
        Replaces the range of text [start, end[ by replacement text
      • setSpan_internal

        protected void setSpan_internal(Object span,
                            int start,
                            int end,
                            int flags)
        Sets a span on the specified range of text
      • setCursorPosition_internal

        protected void setCursorPosition_internal(int start,
                                      int end)
        Moves the cursor to the specified offset position in text
      • getIterableTextForAccessibility

        public CharSequence getIterableTextForAccessibility()
        Description copied from class: View
        Gets the text reported for accessibility purposes.
        Overrides:
        getIterableTextForAccessibility in class View
        Returns:
        The accessibility text.


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 3090 / . Delta: 0.18956 с