Android学习笔记(六)AutoCompleteTextView自动完成文本框

本文详细介绍了Android中的AutoCompleteTextView组件,包括其属性设置、构造方法和公共方法,如设置提示文本、下拉菜单样式和过滤阈值等,展示了如何在应用程序中实现自动完成文本框的功能。
摘要由CSDN通过智能技术生成

                  AutoCompleteTextView自动完成文本框是Android中一个空间,继承于TextView。

                  在Android Developer中的数据属性和方法如下:

 

Summary


Nested Classes
interface AutoCompleteTextView.OnDismissListenerListener to respond to the AutoCompleteTextView's completion list being dismissed. 
interface AutoCompleteTextView.ValidatorThis interface is used to make sure that the text entered in this TextView complies to a certain format. 
XML Attributes
Attribute Name Related Method Description
android:completionHintsetCompletionHint(CharSequence)Defines the hint displayed in the drop down menu. 
android:completionHintView Defines the hint view displayed in the drop down menu. 
android:completionThresholdsetThreshold(int)Defines the number of characters that the user must type before completion suggestions are displayed in a drop down menu. 
android:dropDownAnchorsetDropDownAnchor(int)View to anchor the auto-complete dropdown to. 
android:dropDownHeightsetDropDownHeight(int)Specifies the basic height of the dropdown. 
android:dropDownHorizontalOffset Amount of pixels by which the drop down should be offset horizontally. 
android:dropDownSelector Selector in a drop down list. 
android:dropDownVerticalOffset Amount of pixels by which the drop down should be offset vertically. 
android:dropDownWidthsetDropDownWidth(int)Specifies the basic width of the dropdown. 
android:popupBackgroundsetDropDownBackgroundResource(int) 
[Expand]
Inherited XML Attributes
From class android.widget.TextView
Attribute Name Related Method Description
android:autoLinksetAutoLinkMask(int)Controls whether links such as urls and email addresses are automatically found and converted to clickable links. 
android:autoTextsetKeyListener(KeyListener)If set, specifies that this TextView has a textual input method and automatically corrects some common spelling errors. 
android:bufferTypesetText(CharSequence,TextView.BufferType)Determines the minimum type that getText() will return. 
android:capitalizesetKeyListener(KeyListener)If set, specifies that this TextView has a textual input method and should automatically capitalize what the user types. 
android:cursorVisiblesetCursorVisible(boolean)Makes the cursor visible (the default) or invisible. 
android:digitssetKeyListener(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:drawableBottomsetCompoundDrawablesWithIntrinsicBounds(int,int,int,int)The drawable to be drawn below the text. 
android:drawableEndsetCompoundDrawablesRelativeWithIntrinsicBounds(int,int,int,int)The drawable to be drawn to the end of the text. 
android:drawableLeftsetCompoundDrawablesWithIntrinsicBounds(int,int,int,int)The drawable to be drawn to the left of the text. 
android:drawablePaddingsetCompoundDrawablePadding(int)The padding between the drawables and the text. 
android:drawableRightsetCompoundDrawablesWithIntrinsicBounds(int,int,int,int)The drawable to be drawn to the right of the text. 
android:drawableStartsetCompoundDrawablesRelativeWithIntrinsicBounds(int,int,int,int)The drawable to be drawn to the start of the text. 
android:drawableTopsetCompoundDrawablesWithIntrinsicBounds(int,int,int,int)The drawable to be drawn above the text. 
android:editable If set, specifies that this TextView has an input method. 
android:editorExtrassetInputExtras(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:ellipsizesetEllipsize(TextUtils.TruncateAt)If set, causes words that are longer than the view is wide to be ellipsized instead of broken in the middle. 
android:emssetEms(int)Makes the TextView be exactly this many ems wide. 
android:fontFamilysetTypeface(Typeface)Font family (named by string) for the text. 
android:freezesTextsetFreezesText(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:gravitysetGravity(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:heightsetHeight(int)Makes the TextView be exactly this many pixels tall. 
android:hintsetHint(int)Hint text to display when the text is empty. 
android:imeActionIdsetImeActionLabel(CharSequence,int)Supply a value for EditorInfo.actionId used when an input method is connected to the text view. 
android:imeActionLabelsetImeActionLabel(CharSequence,int)Supply a value for EditorInfo.actionLabel used when an input method is connected to the text view. 
android:imeOptionssetImeOptions(int)Additional features you can enable in an IME associated with an editor to improve the integration with your application. 
android:includeFontPaddingsetIncludeFontPadding(boolean)Leave enough room for ascenders and descenders instead of using the font ascent and descent strictly. 
android:inputMethodsetKeyListener(KeyListener)If set, specifies that this TextView should use the specified input method (specified by fully-qualified class name). 
android:inputTypesetRawInputType(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:lineSpacingExtrasetLineSpacing(float,float)Extra spacing between lines of text. 
android:lineSpacingMultipliersetLineSpacing(float,float)Extra spacing between lines of text, as a multiplier. 
android:linessetLines(int)Makes the TextView be exactly this many lines tall. 
android:linksClickablesetLinksClickable(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:marqueeRepeatLimitsetMarqueeRepeatLimit(int)The number of times to repeat the marquee animation. 
android:maxEmssetMaxEms(int)Makes the TextView be at most this many ems wide. 
android:maxHeightsetMaxHeight(int)Makes the TextView be at most this many pixels tall. 
android:maxLengthsetFilters(InputFilter)Set an input filter to constrain the text length to the specified number. 
android:maxLinessetMaxLines(int)Makes the TextView be at most this many lines tall. 
android:maxWidthsetMaxWidth(int)Makes the TextView be at most this many pixels wide. 
android:minEmssetMinEms(int)Makes the TextView be at least this many ems wide. 
android:minHeightsetMinHeight(int)Makes the TextView be at least this many pixels tall. 
android:minLinessetMinLines(int)Makes the TextView be at least this many lines tall. 
android:minWidthsetMinWidth(int)Makes the TextView be at least this many pixels wide. 
android:numericsetKeyListener(KeyListener)If set, specifies that this TextView has a numeric input method. 
android:passwordsetTransformationMethod(TransformationMethod)Whether the characters of the field are displayed as password dots instead of themselves. 
android:phoneNumbersetKeyListener(KeyListener)If set, specifies that this TextView has a phone number input method. 
android:privateImeOptionssetPrivateImeOptions(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:scrollHorizontallysetHorizontallyScrolling(boolean)Whether the text is allowed to be wider than the view (and therefore can be scrolled horizontally). 
android:selectAllOnFocussetSelectAllOnFocus(boolean)If the text is selectable, select it all when the view takes focus. 
android:shadowColorsetShadowLayer(float,float,float,int)Place a shadow of the specified color behind the text. 
android:shadowDxsetShadowLayer(float,float,float,int)Horizontal offset of the shadow. 
android:shadowDysetShadowLayer(float,float,float,int)Vertical offset of the shadow. 
android:shadowRadiussetShadowLayer(float,float,float,int)Radius of the shadow. 
android:singleLinesetTransformationMethod(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:textsetText(CharSequence,TextView.BufferType)Text to display. 
android:textAllCapssetAllCaps(boolean)Present the text in ALL CAPS. 
android:textAppearance Base text color, typeface, size, and style. 
android:textColorsetTextColor(int)Text color. 
android:textColorHighlightsetHighlightColor(int)Color of the text selection highlight. 
android:textColorHintsetHintTextColor(int)Color of the hint text. 
android:textColorLinksetLinkTextColor(int)Text color for links. 
android:textIsSelectableisTextSelectable()Indicates that the content of a non-editable text can be selected. 
android:textScaleXsetTextScaleX(float)Sets the horizontal scaling factor for the text. 
android:textSizesetTextSize(int,float)Size of the text. 
android:textStylesetTypeface(Typeface)Style (bold, italic, bolditalic) for the text. 
android:typefacesetTypeface(Typeface)Typeface (normal, sans, serif, monospace) for the text. 
android:widthsetWidth(int)Makes the TextView be exactly this many pixels wide. 
From class android.view.View
Attribute Name Related Method Description
android:accessibilityLiveRegionsetAccessibilityLiveRegion(int)Indicates to accessibility services whether the user should be notified when this view changes. 
android:alphasetAlpha(float)alpha property of the view, as a value between 0 (completely transparent) and 1 (completely opaque). 
android:backgroundsetBackgroundResource(int)A drawable to use as the background. 
android:clickablesetClickable(boolean)Defines whether this view reacts to click events. 
android:contentDescriptionsetContentDescription(CharSequence)Defines text that briefly describes content of the view. 
android:drawingCacheQualitysetDrawingCacheQuality(int)Defines the quality of translucent drawing caches. 
android:duplicateParentState When this attribute is set to true, the view gets its drawable state (focused, pressed, etc.) from its direct parent rather than from itself. 
android:fadeScrollbarssetScrollbarFadingEnabled(boolean)Defines whether to fade out scrollbars when they are not in use. 
android:fadingEdgeLengthgetVerticalFadingEdgeLength()Defines the length of the fading edges. 
android:filterTouchesWhenObscuredsetFilterTouchesWhenObscured(boolean)Specifies whether to filter touches when the view's window is obscured by another visible window. 
android:fitsSystemWindowssetFitsSystemWindows(boolean)Boolean internal attribute to adjust view layout based on system windows such as the status bar. 
android:focusablesetFocusable(boolean)Boolean that controls whether a view can take focus. 
android:focusableInTouchModesetFocusableInTouchMode(boolean)Boolean that controls whether a view can take focus while in touch mode. 
android:hapticFeedbackEnabledsetHapticFeedbackEnabled(boolean)Boolean that controls whether a view should have haptic feedback enabled for events such as long presses. 
android:idsetId(int)Supply an identifier name for this view, to later retrieve it with View.findViewById() or Activity.findViewById()
android:importantForAccessibilitysetImportantForAccessibility(int)Controls how this View is important for accessibility which is if it fires accessibility events and if it is reported to accessibility services that query the screen. 
android:isScrollContainersetScrollContainer(boolean)Set this if the view will serve as a scrolling container, meaing that it can be resized to shrink its overall window so that there will be space for an input method. 
android:keepScreenOnsetKeepScreenOn(boolean)Controls whether the view's window should keep the screen on while visible. 
android:layerTypesetLayerType(int,Paint)Specifies the type of layer backing this view. 
android:layoutDirectionsetLayoutDirection(int)Defines the direction of layout drawing. 
android:longClickablesetLongClickable(boolean)Defines whether this view reacts to long click events. 
android:minHeightsetMinimumHeight(int)Defines the minimum height of the view. 
android:minWidthsetMinimumWidth(int)Defines the minimum width of the view. 
android:nextFocusDownsetNextFocusDownId(int)Defines the next view to give focus to when the next focus is FOCUS_DOWN If the reference refers to a view that does not exist or is part of a hierarchy that is invisible, a RuntimeException will result when the reference is accessed. 
android:nextFocusForwardsetNextFocusForwardId(int)Defines the next view to give focus to when the next focus is FOCUS_FORWARD If the reference refers to a view that does not exist or is part of a hierarchy that is invisible, a RuntimeException will result when the reference is accessed. 
android:nextFocusLeftsetNextFocusLeftId(int)Defines the next view to give focus to when the next focus is FOCUS_LEFT
android:nextFocusRightsetNextFocusRightId(int)Defines the next view to give focus to when the next focus is FOCUS_RIGHT If the reference refers to a view that does not exist or is part of a hierarchy that is invisible, a RuntimeException will result when the reference is accessed. 
android:nextFocusUpsetNextFocusUpId(int)Defines the next view to give focus to when the next focus is FOCUS_UP If the reference refers to a view that does not exist or is part of a hierarchy that is invisible, a RuntimeException will result when the reference is accessed. 
android:onClick Name of the method in this View's context to invoke when the view is clicked. 
android:paddingsetPaddingRelative(int,int,int,int)Sets the padding, in pixels, of all four edges. 
android:paddingBottomsetPaddingRelative(int,int,int,int)Sets the padding, in pixels, of the bottom edge; see padding
android:paddingEndsetPaddingRelative(int,int,int,int)Sets the padding, in pixels, of the end edge; see padding
android:paddingLeftsetPadding(int,int,int,int)Sets the padding, in pixels, of the left edge; see padding
android:paddingRightsetPadding(int,int,int,int)Sets the padding, in pixels, of the right edge; see padding
android:paddingStartsetPaddingRelative(int,int,int,int)Sets the padding, in pixels, of the start edge; see padding
android:paddingTopsetPaddingRelative(int,int,int,int)Sets the padding, in pixels, of the top edge; see padding
android:requiresFadingEdgesetVerticalFadingEdgeEnabled(boolean)Defines which edges should be faded on scrolling. 
android:rotationsetRotation(float)rotation of the view, in degrees. 
android:rotationXsetRotationX(float)rotation of the view around the x axis, in degrees. 
android:rotationYsetRotationY(float)rotation of the view around the y axis, in degrees. 
android:saveEnabledsetSaveEnabled(boolean)If unset, no state will be saved for this view when it is being frozen. 
android:scaleXsetScaleX(float)scale of the view in the x direction. 
android:scaleYsetScaleY(float)scale of the view in the y direction. 
android:scrollX The initial horizontal scroll offset, in pixels. 
android:scrollY The initial vertical scroll offset, in pixels. 
android:scrollbarAlwaysDrawHorizontalTrack Defines whether the horizontal scrollbar track should always be drawn. 
android:scrollbarAlwaysDrawVerticalTrack Defines whether the vertical scrollbar track should always be drawn. 
android:scrollbarDefaultDelayBeforeFadesetScrollBarDefaultDelayBeforeFade(int)Defines the delay in milliseconds that a scrollbar waits before fade out. 
android:scrollbarFadeDurationsetScrollBarFadeDuration(int)Defines the delay in milliseconds that a scrollbar takes to fade out. 
android:scrollbarSizesetScrollBarSize(int)Sets the width of vertical scrollbars and height of horizontal scrollbars. 
android:scrollbarStylesetScrollBarStyle(int)Controls the scrollbar style and position. 
android:scrollbarThumbHorizontal Defines the horizontal scrollbar thumb drawable. 
android:scrollbarThumbVertical Defines the vertical scrollbar thumb drawable. 
android:scrollbarTrackHorizontal Defines the horizontal scrollbar track drawable. 
android:scrollbarTrackVertical Defines the vertical scrollbar track drawable. 
android:scrollbars Defines which scrollbars should be displayed on scrolling or not. 
android:soundEffectsEnabledsetSoundEffectsEnabled(boolean)Boolean that controls whether a view should have sound effects enabled for events such as clicking and touching. 
android:tag Supply a tag for this view containing a String, to be retrieved later with View.getTag() or searched for with View.findViewWithTag()
android:textAlignmentsetTextAlignment(int)Defines the alignment of the text. 
android:textDirectionsetTextDirection(int)Defines the direction of the text. 
android:transformPivotXsetPivotX(float)x location of the pivot point around which the view will rotate and scale. 
android:transformPivotYsetPivotY(float)y location of the pivot point around which the view will rotate and scale. 
android:translationXsetTranslationX(float)translation in x of the view. 
android:translationYsetTranslationY(float)translation in y of the view. 
android:visibilitysetVisibility(int)Controls the initial visibility of the view. 
[Expand]
Inherited Constants
From class android.view.View
intACCESSIBILITY_LIVE_REGION_ASSERTIVELive region mode specifying that accessibility services should interrupt ongoing speech to immediately announce changes to this view.
intACCESSIBILITY_LIVE_REGION_NONELive region mode specifying that accessibility services should not automatically announce changes to this view.
intACCESSIBILITY_LIVE_REGION_POLITELive region mode specifying that accessibility services should announce changes to this view.
intDRAWING_CACHE_QUALITY_AUTO

Enables automatic quality mode for the drawing cache.

intDRAWING_CACHE_QUALITY_HIGH

Enables high quality mode for the drawing cache.

intDRAWING_CACHE_QUALITY_LOW

Enables low quality mode for the drawing cache.

intFIND_VIEWS_WITH_CONTENT_DESCRIPTIONFind find views that contain the specified content description.
intFIND_VIEWS_WITH_TEXTFind views that render the specified text.
intFOCUSABLES_ALLView flag indicating whether addFocusables(ArrayList, int, int) should add all focusable Views regardless if they are focusable in touch mode.
intFOCUSABLES_TOUCH_MODEView flag indicating whether addFocusables(ArrayList, int, int) should add only Views focusable in touch mode.
intFOCUS_BACKWARDUse with focusSearch(int).
intFOCUS_DOWNUse with focusSearch(int).
intFOCUS_FORWARDUse with focusSearch(int).
intFOCUS_LEFTUse with focusSearch(int).
intFOCUS_RIGHTUse with focusSearch(int).
intFOCUS_UPUse with focusSearch(int).
intGONEThis view is invisible, and it doesn't take any space for layout purposes.
intHAPTIC_FEEDBACK_ENABLEDView flag indicating whether this view should have haptic feedback enabled for events such as long presses.
intIMPORTANT_FOR_ACCESSIBILITY_AUTOAutomatically determine whether a view is important for accessibility.
intIMPORTANT_FOR_ACCESSIBILITY_NOThe view is not important for accessibility.
intIMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTSThe view is not important for accessibility, nor are any of its descendant views.
intIMPORTANT_FOR_ACCESSIBILITY_YESThe view is important for accessibility.
intINVISIBLEThis view is invisible, but it still takes up space for layout purposes.
intKEEP_SCREEN_ONView flag indicating that the screen should remain on while the window containing this view is visible to the user.
intLAYER_TYPE_HARDWARE

Indicates that the view has a hardware layer.

intLAYER_TYPE_NONEIndicates that the view does not have a layer.
intLAYER_TYPE_SOFTWARE

Indicates that the view has a software layer.

intLAYOUT_DIRECTION_INHERITHorizontal layout direction of this view is inherited from its parent.
intLAYOUT_DIRECTION_LOCALEHorizontal layout direction of this view is from deduced from the default language script for the locale.
intLAYOUT_DIRECTION_LTRHorizontal layout direction of this view is from Left to Right.
intLAYOUT_DIRECTION_RTLHorizontal layout direction of this view is from Right to Left.
intMEASURED_HEIGHT_STATE_SHIFTBit shift of MEASURED_STATE_MASK to get to the height bits for functions that combine both width and height into a single int, such as getMeasuredState() and the childState argument of resolveSizeAndState(int, int, int).
intMEASURED_SIZE_MASKBits of getMeasuredWidthAndState() and getMeasuredWidthAndState() that provide the actual measured size.
intMEASURED_STATE_MASKBits of getMeasuredWidthAndState() and getMeasuredWidthAndState() that provide the additional state bits.
intMEASURED_STATE_TOO_SMALLBit of getMeasuredWidthAndState() and getMeasuredWidthAndState() that indicates the measured size is smaller that the space the view would like to have.
intNO_IDUsed to mark a View that has no ID.
intOVER_SCROLL_ALWAYSAlways allow a user to over-scroll this view, provided it is a view that can scroll.
intOVER_SCROLL_IF_CONTENT_SCROLLSAllow a user to over-scroll this view only if the content is large enough to meaningfully scroll, provided it is a view that can scroll.
intOVER_SCROLL_NEVERNever allow a user to over-scroll this view.
intSCREEN_STATE_OFFIndicates that the screen has changed state and is now off.
intSCREEN_STATE_ONIndicates that the screen has changed state and is now on.
intSCROLLBARS_INSIDE_INSETThe scrollbar style to display the scrollbars inside the padded area, increasing the padding of the view.
intSCROLLBARS_INSIDE_OVERLAYThe scrollbar style to display the scrollbars inside the content area, without increasing the padding.
intSCROLLBARS_OUTSIDE_INSETThe scrollbar style to display the scrollbars at the edge of the view, increasing the padding of the view.
intSCROLLBARS_OUTSIDE_OVERLAYThe scrollbar style to display the scrollbars at the edge of the view, without increasing the padding.
intSCROLLBAR_POSITION_DEFAULTPosition the scroll bar at the default position as determined by the system.
intSCROLLBAR_POSITION_LEFTPosition the scroll bar along the left edge.
intSCROLLBAR_POSITION_RIGHTPosition the scroll bar along the right edge.
intSOUND_EFFECTS_ENABLEDView flag indicating whether this view should have sound effects enabled for events such as clicking and touching.
intSTATUS_BAR_HIDDENThis constant was deprecated in API level 14. Use SYSTEM_UI_FLAG_LOW_PROFILE instead.
intSTATUS_BAR_VISIBLEThis constant was deprecated in API level 14. Use SYSTEM_UI_FLAG_VISIBLE instead.
intSYSTEM_UI_FLAG_FULLSCREENFlag for setSystemUiVisibility(int): View has requested to go into the normal fullscreen mode so that its content can take over the screen while still allowing the user to interact with the application.
intSYSTEM_UI_FLAG_HIDE_NAVIGATIONFlag for setSystemUiVisibility(int): View has requested that the system navigation be temporarily hidden.
intSYSTEM_UI_FLAG_IMMERSIVEFlag for setSystemUiVisibility(int): View would like to remain interactive when hiding the navigation bar with SYSTEM_UI_FLAG_HIDE_NAVIGATION.
intSYSTEM_UI_FLAG_IMMERSIVE_STICKYFlag for setSystemUiVisibility(int): View would like to remain interactive when hiding the status bar with SYSTEM_UI_FLAG_FULLSCREEN and/or hiding the navigation bar with SYSTEM_UI_FLAG_HIDE_NAVIGATION.
intSYSTEM_UI_FLAG_LAYOUT_FULLSCREENFlag for setSystemUiVisibility(int): View would like its window to be layed out as if it has requested SYSTEM_UI_FLAG_FULLSCREEN, even if it currently hasn't.
intSYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATIONFlag for setSystemUiVisibility(int): View would like its window to be layed out as if it has requested SYSTEM_UI_FLAG_HIDE_NAVIGATION, even if it currently hasn't.
intSYSTEM_UI_FLAG_LAYOUT_STABLEFlag for setSystemUiVisibility(int): When using other layout flags, we would like a stable view of the content insets given to fitSystemWindows(Rect).
intSYSTEM_UI_FLAG_LOW_PROFILEFlag for setSystemUiVisibility(int): View has requested the system UI to enter an unobtrusive "low profile" mode.
intSYSTEM_UI_FLAG_VISIBLESpecial constant for setSystemUiVisibility(int): View has requested the system UI (status bar) to be visible (the default).
intSYSTEM_UI_LAYOUT_FLAGSFlags that can impact the layout in relation to system UI.
intTEXT_ALIGNMENT_CENTERCenter the paragraph, e.g.
intTEXT_ALIGNMENT_GRAVITYDefault for the root view.
intTEXT_ALIGNMENT_INHERIT 
intTEXT_ALIGNMENT_TEXT_ENDAlign to the end of the paragraph, e.g.
intTEXT_ALIGNMENT_TEXT_STARTAlign to the start of the paragraph, e.g.
intTEXT_ALIGNMENT_VIEW_ENDAlign to the end of the view, which is ALIGN_RIGHT if the view’s resolved layoutDirection is LTR, and ALIGN_LEFT otherwise.
intTEXT_ALIGNMENT_VIEW_STARTAlign to the start of the view, which is ALIGN_LEFT if the view’s resolved layoutDirection is LTR, and ALIGN_RIGHT otherwise.
intTEXT_DIRECTION_ANY_RTLText direction is using "any-RTL" algorithm.
intTEXT_DIRECTION_FIRST_STRONGText direction is using "first strong algorithm".
intTEXT_DIRECTION_INHERITText direction is inherited thru ViewGroup
intTEXT_DIRECTION_LOCALEText direction is coming from the system Locale.
intTEXT_DIRECTION_LTRText direction is forced to LTR.
intTEXT_DIRECTION_RTLText direction is forced to RTL.
StringVIEW_LOG_TAGThe logging tag used by this class with android.util.Log.
intVISIBLEThis view is visible.
[Expand]
Inherited Fields
From class android.view.View
public static final Property< ViewFloat> ALPHAA Property wrapper around the alpha functionality handled by the setAlpha(float) and getAlpha() methods.
protected static final int[] EMPTY_STATE_SETIndicates the view has no states set.
protected static final int[] ENABLED_FOCUSED_SELECTED_STATE_SETIndicates the view is enabled, focused and selected.
protected static final int[] ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SETIndicates the view is enabled, focused, selected and its window has the focus.
protected static final int[] ENABLED_FOCUSED_STATE_SETIndicates the view is enabled and has the focus.
protected static final int[] ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SETIndicates the view is enabled, focused and its window has the focus.
protected static final int[] ENABLED_SELECTED_STATE_SETIndicates the view is enabled and selected.
protected static final int[] ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SETIndicates the view is enabled, selected and its window has the focus.
protected static final int[] ENABLED_STATE_SETIndicates the view is enabled.
protected static final int[] ENABLED_WINDOW_FOCUSED_STATE_SETIndicates the view is enabled and that its window has focus.
protected static final int[] FOCUSED_SELECTED_STATE_SETIndicates the view is focused and selected.
protected static final int[] FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SETIndicates the view is focused, selected and its window has the focus.
protected static final int[] FOCUSED_STATE_SETIndicates the view is focused.
protected static final int[] FOCUSED_WINDOW_FOCUSED_STATE_SETIndicates the view has the focus and that its window has the focus.
protected static final int[] PRESSED_ENABLED_FOCUSED_SELECTED_STATE_SETIndicates the view is pressed, enabled, focused and selected.
protected static final int[] PRESSED_ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SETIndicates the view is pressed, enabled, focused, selected and its window has the focus.
protected static final int[] PRESSED_ENABLED_FOCUSED_STATE_SETIndicates the view is pressed, enabled and focused.
protected static final int[] PRESSED_ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SETIndicates the view is pressed, enabled, focused and its window has the focus.
protected static final int[] PRESSED_ENABLED_SELECTED_STATE_SETIndicates the view is pressed, enabled and selected.
protected static final int[] PRESSED_ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SETIndicates the view is pressed, enabled, selected and its window has the focus.
protected static final int[] PRESSED_ENABLED_STATE_SETIndicates the view is pressed and enabled.
protected static final int[] PRESSED_ENABLED_WINDOW_FOCUSED_STATE_SETIndicates the view is pressed, enabled and its window has the focus.
protected static final int[] PRESSED_FOCUSED_SELECTED_STATE_SETIndicates the view is pressed, focused and selected.
protected static final int[] PRESSED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SETIndicates the view is pressed, focused, selected and its window has the focus.
protected static final int[] PRESSED_FOCUSED_STATE_SETIndicates the view is pressed and focused.
protected static final int[] PRESSED_FOCUSED_WINDOW_FOCUSED_STATE_SETIndicates the view is pressed, focused and its window has the focus.
protected static final int[] PRESSED_SELECTED_STATE_SETIndicates the view is pressed and selected.
protected static final int[] PRESSED_SELECTED_WINDOW_FOCUSED_STATE_SETIndicates the view is pressed, selected and its window has the focus.
protected static final int[] PRESSED_STATE_SETIndicates the view is pressed.
protected static final int[] PRESSED_WINDOW_FOCUSED_STATE_SETIndicates the view is pressed and its window has the focus.
public static final Property< ViewFloat> ROTATIONA Property wrapper around the rotation functionality handled by the setRotation(float) and getRotation() methods.
public static final Property< ViewFloat> ROTATION_XA Property wrapper around the rotationX functionality handled by the setRotationX(float) and getRotationX() methods.
public static final Property< ViewFloat> ROTATION_YA Property wrapper around the rotationY functionality handled by the setRotationY(float) and getRotationY() methods.
public static final Property< ViewFloat> SCALE_XA Property wrapper around the scaleX functionality handled by the setScaleX(float) and getScaleX() methods.
public static final Property< ViewFloat> SCALE_YA Property wrapper around the scaleY functionality handled by the setScaleY(float) and getScaleY() methods.
protected static final int[] SELECTED_STATE_SETIndicates the view is selected.
protected static final int[] SELECTED_WINDOW_FOCUSED_STATE_SETIndicates the view is selected and that its window has the focus.
public static final Property< ViewFloat> TRANSLATION_XA Property wrapper around the translationX functionality handled by the setTranslationX(float) and getTranslationX() methods.
public static final Property< ViewFloat> TRANSLATION_YA Property wrapper around the translationY functionality handled by the setTranslationY(float) and getTranslationY() methods.
protected static final int[] WINDOW_FOCUSED_STATE_SETIndicates the view's window has focus.
public static final Property< ViewFloat> XA Property wrapper around the x functionality handled by the setX(float) and getX() methods.
public static final Property< ViewFloat> YA Property wrapper around the y functionality handled by the setY(float) and getY() methods.
Public Constructors
AutoCompleteTextView( Context context)
AutoCompleteTextView( Context context, AttributeSet attrs)
AutoCompleteTextView( Context context, AttributeSet attrs, int defStyle)
Public Methods
void clearListSelection()

Clear the list selection.

void dismissDropDown()

Closes the drop down if present on screen.

boolean enoughToFilter()
Returns true if the amount of text in the field meets or exceeds the getThreshold() requirement.
ListAdapter getAdapter()

Returns a filterable list adapter used for auto completion.

CharSequence getCompletionHint()
Gets the optional hint text displayed at the bottom of the the matching list.
int getDropDownAnchor()

Returns the id for the view that the auto-complete drop down list is anchored to.

Drawable getDropDownBackground()

Gets the background of the auto-complete drop-down list.

int getDropDownHeight()

Returns the current height for the auto-complete drop down list.

int getDropDownHorizontalOffset()

Gets the horizontal offset used for the auto-complete drop-down list.

int getDropDownVerticalOffset()

Gets the vertical offset used for the auto-complete drop-down list.

int getDropDownWidth()

Returns the current width for the auto-complete drop down list.

AdapterView.OnItemClickListener getItemClickListener()
This method was deprecated in API level 3. Use getOnItemClickListener() intead
AdapterView.OnItemSelectedListener getItemSelectedListener()
This method was deprecated in API level 3. Use getOnItemSelectedListener() intead
int getListSelection()
Get the position of the dropdown view selection, if there is one.
AdapterView.OnItemClickListener getOnItemClickListener()

Returns the listener that is notified whenever the user clicks an item in the drop down list.

AdapterView.OnItemSelectedListener getOnItemSelectedListener()

Returns the listener that is notified whenever the user selects an item in the drop down list.

int getThreshold()

Returns the number of characters the user must type before the drop down list is shown.

AutoCompleteTextView.Validator getValidator()
Returns the Validator set with setValidator(AutoCompleteTextView.Validator), or null if it was not set.
boolean isPerformingCompletion()
Identifies whether the view is currently performing a text completion, so subclasses can decide whether to respond to text changed events.
boolean isPopupShowing()

Indicates whether the popup menu is showing.

void onCommitCompletion( CompletionInfo completion)
Called by the framework in response to a text completion from the current input method, provided by it calling InputConnection.commitCompletion().
void onFilterComplete(int count)

Notifies the end of a filtering operation.

boolean onKeyDown(int keyCode, KeyEvent event)
Default implementation of KeyEvent.Callback.onKeyDown(): perform press of the view when KEYCODE_DPAD_CENTER or KEYCODE_ENTER is released, if the view is enabled and clickable.
boolean onKeyPreIme(int keyCode, KeyEvent event)
Handle a key event before it is processed by any input method associated with the view hierarchy.
boolean onKeyUp(int keyCode, KeyEvent event)
Default implementation of KeyEvent.Callback.onKeyUp(): perform clicking of the view when KEYCODE_DPAD_CENTER or KEYCODE_ENTER is released.
void onWindowFocusChanged(boolean hasWindowFocus)
Called when the window containing this view gains or loses focus.
void performCompletion()

Performs the text completion by converting the selected item from the drop down list into a string, replacing the text box's content with this string and finally dismissing the drop down menu.

void performValidation()
If a validator was set on this view and the current string is not valid, ask the validator to fix it.
<T extends  ListAdapter &  Filterable> void setAdapter(T adapter)

Changes the list of data used for auto completion.

void setCompletionHint( CharSequence hint)

Sets the optional hint text that is displayed at the bottom of the the matching list.

void setDropDownAnchor(int id)

Sets the view to which the auto-complete drop down list should anchor.

void setDropDownBackgroundDrawable( Drawable d)

Sets the background of the auto-complete drop-down list.

void setDropDownBackgroundResource(int id)

Sets the background of the auto-complete drop-down list.

void setDropDownHeight(int height)

Sets the current height for the auto-complete drop down list.

void setDropDownHorizontalOffset(int offset)

Sets the horizontal offset used for the auto-complete drop-down list.

void setDropDownVerticalOffset(int offset)

Sets the vertical offset used for the auto-complete drop-down list.

void setDropDownWidth(int width)

Sets the current width for the auto-complete drop down list.

void setListSelection(int position)
Set the position of the dropdown view selection.
void setOnClickListener( View.OnClickListener listener)
Register a callback to be invoked when this view is clicked.
void setOnDismissListener( AutoCompleteTextView.OnDismissListener dismissListener)
Set a listener that will be invoked whenever the AutoCompleteTextView's list of completions is dismissed.
void setOnItemClickListener( AdapterView.OnItemClickListener l)

Sets the listener that will be notified when the user clicks an item in the drop down list.

void setOnItemSelectedListener( AdapterView.OnItemSelectedListener l)

Sets the listener that will be notified when the user selects an item in the drop down list.

void setText( CharSequence text, boolean filter)
Like setText(CharSequence), except that it can disable filtering.
void setThreshold(int threshold)

Specifies the minimum number of characters the user has to type in the edit box before the drop down list is shown.

void setValidator( AutoCompleteTextView.Validator validator)
Sets the validator used to perform text validation.
void showDropDown()

Displays the drop down on screen.

Protected Methods
CharSequence convertSelectionToString( Object selectedItem)

Converts the selected item from the drop down list into a sequence of character that can be used in the edit box.

Filter getFilter()
Returns the Filter obtained from getFilter(), or null if setAdapter(T) was not called with a Filterable.
void onAttachedToWindow()
This is called when the view is attached to a window.
void onDetachedFromWindow()
This is called when the view is detached from a window.
void onDisplayHint(int hint)
Gives this view a hint about whether is displayed or not.
void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect)
Called by the view system when the focus state of this view changes.
void performFiltering( CharSequence text, int keyCode)

Starts filtering the content of the drop down list.

void replaceText( CharSequence text)

Performs the text completion by replacing the current text by the selected item.

boolean setFrame(int l, int t, int r, int b)
Assign a size and position to this view.
[Expand]
Inherited Methods
From class android.widget.EditText
void extendSelection(int index)
boolean getDefaultEditable()
Subclasses override this to specify that they have a KeyListener by default even if not specifically called for in the XML options.
MovementMethod getDefaultMovementMethod()
Subclasses override this to specify a default movement method.
Editable getText()
Return the text the TextView is displaying.
void onInitializeAccessibilityEvent( AccessibilityEvent event)
Initializes an AccessibilityEvent with information about this View which is the event source.
void onInitializeAccessibilityNodeInfo( AccessibilityNodeInfo info)
Initializes an AccessibilityNodeInfo with information about this view.
void selectAll()
Convenience for selectAll(Spannable).
void setEllipsize( TextUtils.TruncateAt ellipsis)
Causes words in the text that are longer than the view is wide to be ellipsized instead of broken in the middle.
void setSelection(int index)
Convenience for setSelection(Spannable, int).
void setSelection(int start, int stop)
void setText( CharSequence text, TextView.BufferType type)
Sets the text that this TextView is to display (see setText(CharSequence)) and also sets whether it is stored in a styleable/spannable buffer and whether it is editable.
From class android.widget.TextView
void addTextChangedListener( TextWatcher watcher)
Adds a TextWatcher to the list of those whose methods are called whenever this TextView's text changes.
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.
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.
void beginBatchEdit()
boolean bringPointIntoView(int offset)
Move the point, specified by the offset, into the view if it is needed.
void cancelLongPress()
Cancels a pending long press.
void clearComposingText()
Use BaseInputConnection.removeComposingSpans() to remove any IME composing state from this text view.
int computeHorizontalScrollRange()

Compute the horizontal range that the horizontal scrollbar represents.

void computeScroll()
Called by a parent to request that a child update its values for mScrollX and mScrollY if necessary.
int computeVerticalScrollExtent()

Compute the vertical extent of the horizontal scrollbar's thumb within the vertical range.

int computeVerticalScrollRange()

Compute the vertical range that the vertical scrollbar represents.

void debug(int depth)
Prints information about this view in the log output, with the tag VIEW_LOG_TAG.
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.
void drawableStateChanged()
This function is called whenever the state of the view changes in such a way that it impacts the state of drawables being shown.
void endBatchEdit()
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.
void findViewsWithText( ArrayList< View> outViews, CharSequence searched, int flags)
Finds the Views that contain given text.
final int getAutoLinkMask()
Gets the autolink mask of the text.
int getBaseline()

Return the offset of the widget's text baseline from the widget's top boundary.

int getBottomPaddingOffset()
Amount by which to extend the bottom fading region.
int getCompoundDrawablePadding()
Returns the padding between the compound drawables and the text.
Drawable[] getCompoundDrawables()
Returns drawables for the left, top, right, and bottom borders.
Drawable[] getCompoundDrawablesRelative()
Returns drawables for the start, top, end, and bottom borders.
int getCompoundPaddingBottom()
Returns the bottom padding of the view, plus space for the bottom Drawable if any.
int getCompoundPaddingEnd()
Returns the end padding of the view, plus space for the end Drawable if any.
int getCompoundPaddingLeft()
Returns the left padding of the view, plus space for the left Drawable if any.
int getCompoundPaddingRight()
Returns the right padding of the view, plus space for the right Drawable if any.
int getCompoundPaddingStart()
Returns the start padding of the view, plus space for the start Drawable if any.
int getCompoundPaddingTop()
Returns the top padding of the view, plus space for the top Drawable if any.
final int getCurrentHintTextColor()

Return the current color selected to paint the hint text.

final int getCurrentTextColor()

Return the current color selected for normal text.

ActionMode.Callback getCustomSelectionActionModeCallback()
boolean getDefaultEditable()
Subclasses override this to specify that they have a KeyListener by default even if not specifically called for in the XML options.
MovementMethod getDefaultMovementMethod()
Subclasses override this to specify a default movement method.
Editable getEditableText()
Return the text the TextView is displaying as an Editable object.
TextUtils.TruncateAt getEllipsize()
Returns where, if anywhere, words that are longer than the view is wide should be ellipsized.
CharSequence getError()
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.
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.
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.
InputFilter[] getFilters()
Returns the current list of input filters.
void getFocusedRect( Rect r)
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.
boolean getFreezesText()
Return whether this text view is including its entire text contents in frozen icicles.
int getGravity()
Returns the horizontal and vertical alignment of this TextView.
int getHighlightColor()
CharSequence getHint()
Returns the hint that is displayed when the text of the TextView is empty.
final ColorStateList getHintTextColors()
int getImeActionId()
Get the IME action ID previous set with setImeActionLabel(CharSequence, int).
CharSequence getImeActionLabel()
Get the IME action label previous set with setImeActionLabel(CharSequence, int).
int getImeOptions()
Get the type of the IME editor.
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.
Bundle getInputExtras(boolean create)
Retrieve the input extras currently associated with the text view, which can be viewed as well as modified.
int getInputType()
Get the type of the editable content.
final KeyListener getKeyListener()
final Layout getLayout()
float getLeftFadingEdgeStrength()
Returns the strength, or intensity, of the left faded edge.
int getLeftPaddingOffset()
Amount by which to extend the left fading region.
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.
int getLineCount()
Return the number of lines of text, or 0 if the internal Layout has not been built.
int getLineHeight()
float getLineSpacingExtra()
Gets the line spacing extra space
float getLineSpacingMultiplier()
Gets the line spacing multiplier
final ColorStateList getLinkTextColors()
final boolean getLinksClickable()
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).
int getMarqueeRepeatLimit()
Gets the number of times the marquee animation is repeated.
int getMaxEms()
int getMaxHeight()
int getMaxLines()
int getMaxWidth()
int getMinEms()
int getMinHeight()
int getMinLines()
int getMinWidth()
final MovementMethod getMovementMethod()
int getOffsetForPosition(float x, float y)
Get the character offset closest to the specified absolute position.
TextPaint getPaint()
int getPaintFlags()
String getPrivateImeOptions()
Get the private type of the content.
float getRightFadingEdgeStrength()
Returns the strength, or intensity, of the right faded edge.
int getRightPaddingOffset()
Amount by which to extend the right fading region.
int getSelectionEnd()
int getSelectionStart()
int getShadowColor()
float getShadowDx()
float getShadowDy()
float getShadowRadius()
Gets the radius of the shadow layer.
CharSequence getText()
Return the text the TextView is displaying.
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.
final ColorStateList getTextColors()
Gets the text colors for the different states (normal, selected, focused) of the TextView.
static ColorStateList getTextColors( Context context, TypedArray attrs)
Returns the TextView_textColor attribute from the TypedArray, if set, or the TextAppearance_textColor from the TextView_textAppearance attribute, if TextView_textColor was not set directly.
Locale getTextLocale()
Get the default Locale of the text in this TextView.
float getTextScaleX()
float getTextSize()
int getTopPaddingOffset()
Amount by which to extend the top fading region.
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.
int getTotalPaddingEnd()
Returns the total end padding of the view, including the end Drawable if any.
int getTotalPaddingLeft()
Returns the total left padding of the view, including the left Drawable if any.
int getTotalPaddingRight()
Returns the total right padding of the view, including the right Drawable if any.
int getTotalPaddingStart()
Returns the total start padding of the view, including the start Drawable if any.
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.
final TransformationMethod getTransformationMethod()
Typeface getTypeface()
URLSpan[] getUrls()
Returns the list of URLSpans attached to the text (by Linkify or otherwise) if any.
boolean hasOverlappingRendering()
Returns whether this View has content which overlaps.
boolean hasSelection()
Return true iff there is a selection inside this text view.
void invalidateDrawable( Drawable drawable)
Invalidates the specified Drawable.
boolean isCursorVisible()
boolean isInputMethodTarget()
Returns whether this text view is a current input method target.
boolean isPaddingOffsetRequired()
If the View draws content inside its padding and enables fading edges, it needs to support padding offsets.
boolean isSuggestionsEnabled()
Return whether or not suggestions are enabled on this TextView.
boolean isTextSelectable()
Returns the state of the textIsSelectable flag (See setTextIsSelectable()).
void jumpDrawablesToCurrentState()
Call Drawable.jumpToCurrentState() on all Drawable objects associated with this view.
int length()
Returns the length, in characters, of the text managed by this TextView
boolean moveCursorToVisibleOffset()
Move the cursor, if needed, so that it is at an offset that is visible to the user.
void onAttachedToWindow()
This is called when the view is attached to a window.
void onBeginBatchEdit()
Called by the framework in response to a request to begin a batch of edit operations through a call to link beginBatchEdit().
boolean onCheckIsTextEditor()
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.
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().
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 commitCorrection(CorrectionInfo) InputConnection.commitCorrection()}.
int[] onCreateDrawableState(int extraSpace)
Generate the new Drawable state for this view.
InputConnection onCreateInputConnection( EditorInfo outAttrs)
Create a new InputConnection for an InputMethod to interact with the view.
void onDetachedFromWindow()
This is called when the view is detached from a window.
boolean onDragEvent( DragEvent event)
Handles drag events sent by the system following a call to startDrag().
void onDraw( Canvas canvas)
Implement this to do your drawing.
void onEditorAction(int actionCode)
Called when an attached input method calls InputConnection.performEditorAction() for this text view.
void onEndBatchEdit()
Called by the framework in response to a request to end a batch of edit operations through a call to link endBatchEdit().
void onFinishTemporaryDetach()
Called after onStartTemporaryDetach() when the container is done changing the view.
void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect)
Called by the view system when the focus state of this view changes.
boolean onGenericMotionEvent( MotionEvent event)
Implement this method to handle generic motion events.
void onInitializeAccessibilityEvent( AccessibilityEvent event)
Initializes an AccessibilityEvent with information about this View which is the event source.
void onInitializeAccessibilityNodeInfo( AccessibilityNodeInfo info)
Initializes an AccessibilityNodeInfo with information about this view.
boolean onKeyDown(int keyCode, KeyEvent event)
Default implementation of KeyEvent.Callback.onKeyDown(): perform press of the view when KEYCODE_DPAD_CENTER or KEYCODE_ENTER is released, if the view is enabled and clickable.
boolean onKeyMultiple(int keyCode, int repeatCount, KeyEvent event)
Default implementation of KeyEvent.Callback.onKeyMultiple(): always returns false (doesn't handle the event).
boolean onKeyPreIme(int keyCode, KeyEvent event)
Handle a key event before it is processed by any input method associated with the view hierarchy.
boolean onKeyShortcut(int keyCode, KeyEvent event)
Called on the focused view when a key shortcut event is not handled.
boolean onKeyUp(int keyCode, KeyEvent event)
Default implementation of KeyEvent.Callback.onKeyUp(): perform clicking of the view when KEYCODE_DPAD_CENTER or KEYCODE_ENTER is released.
void onLayout(boolean changed, int left, int top, int right, int bottom)
Called from layout when this view should assign a size and position to each of its children.
void onMeasure(int widthMeasureSpec, int heightMeasureSpec)

Measure the view and its content to determine the measured width and the measured height.

void onPopulateAccessibilityEvent( AccessibilityEvent event)
Called from dispatchPopulateAccessibilityEvent(AccessibilityEvent) giving a chance to this View to populate the accessibility event with its text content.
boolean onPreDraw()
Callback method to be invoked when the view tree is about to be drawn.
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().
void onRestoreInstanceState( Parcelable state)
Hook allowing a view to re-apply a representation of its internal state that had previously been generated by onSaveInstanceState().
void onRtlPropertiesChanged(int layoutDirection)
Called when any RTL property (layout direction or text direction or text alignment) has been changed.
Parcelable 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.
void onScreenStateChanged(int screenState)
This method is called whenever the state of the screen this view is attached to changes.
void onScrollChanged(int horiz, int vert, int oldHoriz, int oldVert)
This is called in response to an internal scroll in this view (i.e., the view scrolled its own contents).
void onSelectionChanged(int selStart, int selEnd)
This method is called when the selection has changed, in case any subclasses would like to know.
void onStartTemporaryDetach()
This is called when a container is going to temporarily detach a child, with ViewGroup.detachViewFromParent.
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.
boolean onTextContextMenuItem(int id)
Called when a context menu option for the text view is selected.
boolean onTouchEvent( MotionEvent event)
Implement this method to handle touch screen motion events.
boolean onTrackballEvent( MotionEvent event)
Implement this method to handle trackball motion events.
void onVisibilityChanged( View changedView, int visibility)
Called when the visibility of the view or an ancestor of the view is changed.
void onWindowFocusChanged(boolean hasWindowFocus)
Called when the window containing this view gains or loses focus.
boolean performAccessibilityAction(int action, Bundle arguments)
Performs the specified accessibility action on the view.
boolean performLongClick()
Call this view's OnLongClickListener, if it is defined.
void removeTextChangedListener( TextWatcher watcher)
Removes the specified TextWatcher from the list of those whose methods are called whenever this TextView's text changes.
void sendAccessibilityEvent(int eventType)
Sends an accessibility event of the given type.
void setAllCaps(boolean allCaps)
Sets the properties of this field to transform input to ALL CAPS display.
final void setAutoLinkMask(int mask)
Sets the autolink mask of the text.
void setCompoundDrawablePadding(int pad)
Sets the size of the padding between the compound drawables and the text.
void setCompoundDrawables( 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.
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.
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.
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.
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.
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.
void setCursorVisible(boolean visible)
Set whether the cursor is visible.
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.
final void setEditableFactory( Editable.Factory factory)
Sets the Factory used to create new Editables.
void setEllipsize( TextUtils.TruncateAt where)
Causes words in the text that are longer than the view is wide to be ellipsized instead of broken in the middle.
void setEms(int ems)
Makes the TextView exactly this many ems wide
void setEnabled(boolean enabled)
Set the enabled state of this view.
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.
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.
void setExtractedText( ExtractedText text)
Apply to this text view the given extracted text, as previously returned by extractText(ExtractedTextRequest, ExtractedText).
void setFilters( InputFilter[] filters)
Sets the list of input filters that will be used if the buffer is Editable.
boolean setFrame(int l, int t, int r, int b)
Assign a size and position to this view.
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.
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.
void setHeight(int pixels)
Makes the TextView exactly this many pixels tall.
void setHighlightColor(int color)
Sets the color used to display the selection highlight.
final void setHint( CharSequence hint)
Sets the text to be displayed when the text of the TextView is empty.
final void setHint(int resid)
Sets the text to be displayed when the text of the TextView is empty, from a resource.
final void setHintTextColor( ColorStateList colors)
Sets the color of the hint text.
final void setHintTextColor(int color)
Sets the color of the hint text for all the states (disabled, focussed, selected...) of this TextView.
void setHorizontallyScrolling(boolean whether)
Sets whether the text should be allowed to be wider than the View is.
void setImeActionLabel( CharSequence label, int actionId)
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.
void setImeOptions(int imeOptions)
Change the editor type integer associated with the text view, which will be reported to an IME with imeOptions when it has focus.
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.
void setInputExtras(int xmlResId)
Set the extra input data of the text, which is the TextBoxAttribute.extras Bundle that will be filled in when creating an input connection.
void setInputType(int type)
Set the type of the content with a constant as defined for inputType.
void setKeyListener( KeyListener input)
Sets the key listener to be used with this TextView.
void setLineSpacing(float add, float mult)
Sets line spacing for this TextView.
void setLines(int lines)
Makes the TextView exactly this many lines tall.
final void setLinkTextColor( ColorStateList colors)
Sets the color of links in the text.
final void setLinkTextColor(int color)
Sets the color of links in the text.
final void setLinksClickable(boolean whether)
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).
void setMarqueeRepeatLimit(int marqueeLimit)
Sets how many times to repeat the marquee animation.
void setMaxEms(int maxems)
Makes the TextView at most this many ems wide
void setMaxHeight(int maxHeight)
Makes the TextView at most this many pixels tall.
void setMaxLines(int maxlines)
Makes the TextView at most this many lines tall.
void setMaxWidth(int maxpixels)
Makes the TextView at most this many pixels wide
void setMinEms(int minems)
Makes the TextView at least this many ems wide
void setMinHeight(int minHeight)
Makes the TextView at least this many pixels tall.
void setMinLines(int minlines)
Makes the TextView at least this many lines tall.
void setMinWidth(int minpixels)
Makes the TextView at least this many pixels wide
final void setMovementMethod( MovementMethod movement)
Sets the movement method (arrow key handler) to be used for this TextView.
void setOnEditorActionListener( TextView.OnEditorActionListener l)
Set a special listener to be called when an action is performed on the text view.
void setPadding(int left, int top, int right, int bottom)
Sets the padding.
void setPaddingRelative(int start, int top, int end, int bottom)
Sets the relative padding.
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.
void setPrivateImeOptions( String type)
Set the private content type of the text, which is the EditorInfo.privateImeOptions field that will be filled in when creating an input connection.
void setRawInputType(int type)
Directly change the content type integer of the text view, without modifying any other state.
void setScroller( Scroller s)
void setSelectAllOnFocus(boolean selectAllOnFocus)
Set the TextView so that when it takes focus, all the text is selected.
void setSelected(boolean selected)
Changes the selection state of this view.
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.
void setSingleLine()
Sets the properties of this field (lines, horizontally scrolling, transformation method) to be for a single-line input.
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.
final void setSpannableFactory( Spannable.Factory factory)
Sets the Factory used to create new Spannables.
final void setText(int resid)
final void setText(char[] text, int start, int len)
Sets the TextView to display the specified slice of the specified char array.
final void setText(int resid, TextView.BufferType type)
final void setText( CharSequence text)
Sets the string value of the TextView.
void setText( CharSequence text, TextView.BufferType type)
Sets the text that this TextView is to display (see setText(CharSequence)) and also sets whether it is stored in a styleable/spannable buffer and whether it is editable.
void setTextAppearance( Context context, int resid)
Sets the text color, size, style, hint color, and highlight color from the specified TextAppearance resource.
void setTextColor( ColorStateList colors)
Sets the text color.
void setTextColor(int color)
Sets the text color for all the states (normal, selected, focused) to be this color.
void setTextIsSelectable(boolean selectable)
Sets whether the content of this view is selectable by the user.
final void setTextKeepState( CharSequence text)
Like setText(CharSequence), except that the cursor position (if any) is retained in the new text.
final void setTextKeepState( CharSequence text, TextView.BufferType type)
Like setText(CharSequence, android.widget.TextView.BufferType), except that the cursor position (if any) is retained in the new text.
void setTextLocale( Locale locale)
Set the default Locale of the text in this TextView to the given value.
void setTextScaleX(float size)
Sets the extent by which text should be stretched horizontally.
void setTextSize(float size)
Set the default text size to the given value, interpreted as "scaled pixel" units.
void setTextSize(int unit, float size)
Set the default text size to a given unit and value.
final void setTransformationMethod( TransformationMethod method)
Sets the transformation that is applied to the text that this TextView is displaying.
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.
void setTypeface( Typeface tf)
Sets the typeface and style in which the text should be displayed.
void setWidth(int pixels)
Makes the TextView exactly this many pixels wide.
boolean verifyDrawable( Drawable who)
If your view subclass is displaying its own Drawable objects, it should override this function and return true for any Drawable it is displaying.
From class android.view.View
void addChildrenForAccessibility( ArrayList< View> children)
Adds the children of a given View for accessibility.
void addFocusables( ArrayList< View> views, int direction, int focusableMode)
Adds any focusable views that are descendants of this view (possibly including this view if it is focusable itself) to views.
void addFocusables( ArrayList< View> views, int direction)
Add any focusable views that are descendants of this view (possibly including this view if it is focusable itself) to views.
void addOnAttachStateChangeListener( View.OnAttachStateChangeListener listener)
Add a listener for attach state changes.
void addOnLayoutChangeListener( View.OnLayoutChangeListener listener)
Add a listener that will be called when the bounds of the view change due to layout processing.
void addTouchables( ArrayList< View> views)
Add any touchable views that are descendants of this view (possibly including this view if it is touchable itself) to views.
ViewPropertyAnimator animate()
This method returns a ViewPropertyAnimator object, which can be used to animate specific properties on this View.
void announceForAccessibility( CharSequence text)
Convenience method for sending a TYPE_ANNOUNCEMENT AccessibilityEvent to make an announcement which is related to some sort of a context change for which none of the events representing UI transitions is a good fit.
boolean awakenScrollBars(int startDelay)

Trigger the scrollbars to draw.

boolean awakenScrollBars(int startDelay, boolean invalidate)

Trigger the scrollbars to draw.

boolean awakenScrollBars()

Trigger the scrollbars to draw.

void bringToFront()
Change the view's z order in the tree, so it's on top of other sibling views.
void buildDrawingCache()

Calling this method is equivalent to calling buildDrawingCache(false).

void buildDrawingCache(boolean autoScale)

Forces the drawing cache to be built if the drawing cache is invalid.

void buildLayer()
Forces this view's layer to be created and this view to be rendered into its layer.
boolean callOnClick()
Directly call any attached OnClickListener.
boolean canResolveLayoutDirection()
Check if layout direction resolution can be done.
boolean canResolveTextAlignment()
Check if text alignment resolution can be done.
boolean canResolveTextDirection()
Check if text direction resolution can be done.
boolean canScrollHorizontally(int direction)
Check if this view can be scrolled horizontally in a certain direction.
boolean canScrollVertically(int direction)
Check if this view can be scrolled vertically in a certain direction.
void cancelLongPress()
Cancels a pending long press.
final void cancelPendingInputEvents()
Cancel any deferred high-level input events that were previously posted to the event queue.
boolean checkInputConnectionProxy( View view)
Called by the InputMethodManager when a view who is not the current input connection target is trying to make a call on the manager.
void clearAnimation()
Cancels any animations for this view.
void clearFocus()
Called when this view wants to give up focus.
static int combineMeasuredStates(int curState, int newState)
Merge two states as returned by getMeasuredState().
int computeHorizontalScrollExtent()

Compute the horizontal extent of the horizontal scrollbar's thumb within the horizontal range.

int computeHorizontalScrollOffset()

Compute the horizontal offset of the horizontal scrollbar's thumb within the horizontal range.

int computeHorizontalScrollRange()

Compute the horizontal range that the horizontal scrollbar represents.

void computeScroll()
Called by a parent to request that a child update its values for mScrollX and mScrollY if necessary.
int computeVerticalScrollExtent()

Compute the vertical extent of the horizontal scrollbar's thumb within the vertical range.

int computeVerticalScrollOffset()

Compute the vertical offset of the vertical scrollbar's thumb within the horizontal range.

int computeVerticalScrollRange()

Compute the vertical range that the vertical scrollbar represents.

AccessibilityNodeInfo createAccessibilityNodeInfo()
Returns an AccessibilityNodeInfo representing this view from the point of view of an AccessibilityService.
void createContextMenu( ContextMenu menu)
Show the context menu for this view.
void destroyDrawingCache()

Frees the resources used by the drawing cache.

void dispatchConfigurationChanged( Configuration newConfig)
Dispatch a notification about a resource configuration change down the view hierarchy.
void dispatchDisplayHint(int hint)
Dispatch a hint about whether this view is displayed.
boolean dispatchDragEvent( DragEvent event)
Detects if this View is enabled and has a drag event listener.
void dispatchDraw( Canvas canvas)
Called by draw to draw the child views.
boolean dispatchGenericFocusedEvent( MotionEvent event)
Dispatch a generic motion event to the currently focused view.
boolean dispatchGenericMotionEvent( MotionEvent event)
Dispatch a generic motion event.
boolean dispatchGenericPointerEvent( MotionEvent event)
Dispatch a generic motion event to the view under the first pointer.
boolean dispatchHoverEvent( MotionEvent event)
Dispatch a hover event.
boolean dispatchKeyEvent( KeyEvent event)
Dispatch a key event to the next view on the focus path.
boolean dispatchKeyEventPreIme( KeyEvent event)
Dispatch a key event before it is processed by any input method associated with the view hierarchy.
boolean dispatchKeyShortcutEvent( KeyEvent event)
Dispatches a key shortcut event.
boolean dispatchPopulateAccessibilityEvent( AccessibilityEvent event)
Dispatches an AccessibilityEvent to the View first and then to its children for adding their text content to the event.
void dispatchRestoreInstanceState( SparseArray< Parcelable> container)
Called by restoreHierarchyState(android.util.SparseArray) to retrieve the state for this view and its children.
void dispatchSaveInstanceState( SparseArray< Parcelable> container)
Called by saveHierarchyState(android.util.SparseArray) to store the state for this view and its children.
void dispatchSetActivated(boolean activated)
Dispatch setActivated to all of this View's children.
void dispatchSetPressed(boolean pressed)
Dispatch setPressed to all of this View's children.
void dispatchSetSelected(boolean selected)
Dispatch setSelected to all of this View's children.
void dispatchSystemUiVisibilityChanged(int visibility)
boolean dispatchTouchEvent( MotionEvent event)
Pass the touch screen motion event down to the target view, or this view if it is the target.
boolean dispatchTrackballEvent( MotionEvent event)
Pass a trackball motion event down to the focused view.
boolean dispatchUnhandledMove( View focused, int direction)
This method is the last chance for the focused view and its ancestors to respond to an arrow key.
void dispatchVisibilityChanged( View changedView, int visibility)
Dispatch a view visibility change down the view hierarchy.
void dispatchWindowFocusChanged(boolean hasFocus)
Called when the window containing this view gains or loses window focus.
void dispatchWindowSystemUiVisiblityChanged(int visible)
Dispatch callbacks to onWindowSystemUiVisibilityChanged(int) down the view hierarchy.
void dispatchWindowVisibilityChanged(int visibility)
Dispatch a window visibility change down the view hierarchy.
void draw( Canvas canvas)
Manually render this view (and all of its children) to the given Canvas.
void drawableStateChanged()
This function is called whenever the state of the view changes in such a way that it impacts the state of drawables being shown.
View findFocus()
Find the view in the hierarchy rooted at this view that currently has focus.
final View findViewById(int id)
Look for a child view with the given id.
final View findViewWithTag( Object tag)
Look for a child view with the given tag.
void findViewsWithText( ArrayList< View> outViews, CharSequence searched, int flags)
Finds the Views that contain given text.
boolean fitSystemWindows( Rect insets)
Called by the view hierarchy when the content insets for a window have changed, to allow it to adjust its content to fit within those windows.
View focusSearch(int direction)
Find the nearest view in the specified direction that can take focus.
void forceLayout()
Forces this view to be laid out during the next layout pass.
static int generateViewId()
Generate a value suitable for use in setId(int).
int getAccessibilityLiveRegion()
Gets the live region mode for this View.
AccessibilityNodeProvider getAccessibilityNodeProvider()
Gets the provider for managing a virtual view hierarchy rooted at this View and reported to AccessibilityServices that explore the window content.
float getAlpha()
The opacity of the view.
Animation getAnimation()
Get the animation currently associated with this view.
IBinder getApplicationWindowToken()
Retrieve a unique token identifying the top-level "real" window of the window that this view is attached to.
Drawable getBackground()
Gets the background drawable
int getBaseline()

Return the offset of the widget's text baseline from the widget's top boundary.

final int getBottom()
Bottom position of this view relative to its parent.
float getBottomFadingEdgeStrength()
Returns the strength, or intensity, of the bottom faded edge.
int getBottomPaddingOffset()
Amount by which to extend the bottom fading region.
float getCameraDistance()
Gets the distance along the Z axis from the camera to this view.
Rect getClipBounds()
Returns a copy of the current clipBounds.
CharSequence getContentDescription()
Gets the View description.
final Context getContext()
Returns the context the view is running in, through which it can access the current theme, resources, etc.
ContextMenu.ContextMenuInfo getContextMenuInfo()
Views should implement this if they have extra information to associate with the context menu.
static int getDefaultSize(int size, int measureSpec)
Utility to return a default size.
Display getDisplay()
Gets the logical display to which the view's window has been attached.
final int[] getDrawableState()
Return an array of resource IDs of the drawable states representing the current state of the view.
Bitmap getDrawingCache(boolean autoScale)

Returns the bitmap in which this view drawing is cached.

Bitmap getDrawingCache()

Calling this method is equivalent to calling getDrawingCache(false).

int getDrawingCacheBackgroundColor()
int getDrawingCacheQuality()
Returns the quality of the drawing cache.
void getDrawingRect( Rect outRect)
Return the visible drawing bounds of your view.
long getDrawingTime()

Return the time at which the drawing of the view hierarchy started.

boolean getFilterTouchesWhenObscured()
Gets whether the framework should discard touches when the view's window is obscured by another visible window.
boolean getFitsSystemWindows()
Check for state of setFitsSystemWindows(boolean).
ArrayList< View> getFocusables(int direction)
Find and return all focusable views that are descendants of this view, possibly including this view if it is focusable itself.
void getFocusedRect( Rect r)
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.
boolean getGlobalVisibleRect( Rect r, Point globalOffset)
If some part of this view is not clipped by any of its parents, then return that area in r in global (root) coordinates.
final boolean getGlobalVisibleRect( Rect r)
Handler getHandler()
final int getHeight()
Return the height of your view.
void getHitRect( Rect outRect)
Hit rectangle in parent's coordinates
int getHorizontalFadingEdgeLength()
Returns the size of the horizontal faded edges used to indicate that more content in this view is visible.
int getHorizontalScrollbarHeight()
Returns the height of the horizontal scrollbar.
int getId()
Returns this view's identifier.
int getImportantForAccessibility()
Gets the mode for determining whether this View is important for accessibility which is if it fires accessibility events and if it is reported to accessibility services that query the screen.
boolean getKeepScreenOn()
Returns whether the screen should remain on, corresponding to the current value of KEEP_SCREEN_ON.
KeyEvent.DispatcherState getKeyDispatcherState()
Return the global KeyEvent.DispatcherState for this view's window.
int getLabelFor()
Gets the id of a view for which this view serves as a label for accessibility purposes.
int getLayerType()
Indicates what type of layer is currently associated with this view.
int getLayoutDirection()
Returns the resolved layout direction for this view.
ViewGroup.LayoutParams getLayoutParams()
Get the LayoutParams associated with this view.
final int getLeft()
Left position of this view relative to its parent.
float getLeftFadingEdgeStrength()
Returns the strength, or intensity, of the left faded edge.
int getLeftPaddingOffset()
Amount by which to extend the left fading region.
final boolean getLocalVisibleRect( Rect r)
void getLocationInWindow(int[] location)

Computes the coordinates of this view in its window.

void getLocationOnScreen(int[] location)

Computes the coordinates of this view on the screen.

Matrix getMatrix()
The transform matrix of this view, which is calculated based on the current roation, scale, and pivot properties.
final int getMeasuredHeight()
Like getMeasuredHeightAndState(), but only returns the raw width component (that is the result is masked by MEASURED_SIZE_MASK).
final int getMeasuredHeightAndState()
Return the full height measurement information for this view as computed by the most recent call to measure(int, int).
final int getMeasuredState()
Return only the state bits of getMeasuredWidthAndState() and getMeasuredHeightAndState(), combined into one integer.
final int getMeasuredWidth()
Like getMeasuredWidthAndState(), but only returns the raw width component (that is the result is masked by MEASURED_SIZE_MASK).
final int getMeasuredWidthAndState()
Return the full width measurement information for this view as computed by the most recent call to measure(int, int).
int getMinimumHeight()
Returns the minimum height of the view.
int getMinimumWidth()
Returns the minimum width of the view.
int getNextFocusDownId()
Gets the id of the view to use when the next focus is FOCUS_DOWN.
int getNextFocusForwardId()
Gets the id of the view to use when the next focus is FOCUS_FORWARD.
int getNextFocusLeftId()
Gets the id of the view to use when the next focus is FOCUS_LEFT.
int getNextFocusRightId()
Gets the id of the view to use when the next focus is FOCUS_RIGHT.
int getNextFocusUpId()
Gets the id of the view to use when the next focus is FOCUS_UP.
View.OnFocusChangeListener getOnFocusChangeListener()
Returns the focus-change callback registered for this view.
int getOverScrollMode()
Returns the over-scroll mode for this view.
ViewOverlay getOverlay()
Returns the overlay for this view, creating it if it does not yet exist.
int getPaddingBottom()
Returns the bottom padding of this view.
int getPaddingEnd()
Returns the end padding of this view depending on its resolved layout direction.
int getPaddingLeft()
Returns the left padding of this view.
int getPaddingRight()
Returns the right padding of this view.
int getPaddingStart()
Returns the start padding of this view depending on its resolved layout direction.
int getPaddingTop()
Returns the top padding of this view.
final ViewParent getParent()
Gets the parent of this view.
ViewParent getParentForAccessibility()
Gets the parent for accessibility purposes.
float getPivotX()
The x location of the point around which the view is rotated and scaled.
float getPivotY()
The y location of the point around which the view is rotated and scaled.
Resources getResources()
Returns the resources associated with this view.
final int getRight()
Right position of this view relative to its parent.
float getRightFadingEdgeStrength()
Returns the strength, or intensity, of the right faded edge.
int getRightPaddingOffset()
Amount by which to extend the right fading region.
View getRootView()

Finds the topmost view in the current view hierarchy.

float getRotation()
The degrees that the view is rotated around the pivot point.
float getRotationX()
The degrees that the view is rotated around the horizontal axis through the pivot point.
float getRotationY()
The degrees that the view is rotated around the vertical axis through the pivot point.
float getScaleX()
The amount that the view is scaled in x around the pivot point, as a proportion of the view's unscaled width.
float getScaleY()
The amount that the view is scaled in y around the pivot point, as a proportion of the view's unscaled height.
int getScrollBarDefaultDelayBeforeFade()
Returns the delay before scrollbars fade.
int getScrollBarFadeDuration()
Returns the scrollbar fade duration.
int getScrollBarSize()
Returns the scrollbar size.
int getScrollBarStyle()

Returns the current scrollbar style.

final int getScrollX()
Return the scrolled left position of this view.
final int getScrollY()
Return the scrolled top position of this view.
int getSolidColor()
Override this if your view is known to always be drawn on top of a solid color background, and needs to draw fading edges.
int getSuggestedMinimumHeight()
Returns the suggested minimum height that the view should use.
int getSuggestedMinimumWidth()
Returns the suggested minimum width that the view should use.
int getSystemUiVisibility()
Returns the last setSystemUiVisibility(int) that this view has requested.
Object getTag(int key)
Returns the tag associated with this view and the specified key.
Object getTag()
Returns this view's tag.
int getTextAlignment()
Return the resolved text alignment.
int getTextDirection()
Return the resolved text direction.
final int getTop()
Top position of this view relative to its parent.
float getTopFadingEdgeStrength()
Returns the strength, or intensity, of the top faded edge.
int getTopPaddingOffset()
Amount by which to extend the top fading region.
TouchDelegate getTouchDelegate()
Gets the TouchDelegate for this View.
ArrayList< View> getTouchables()
Find and return all touchable views that are descendants of this view, possibly including this view if it is touchable itself.
float getTranslationX()
The horizontal location of this view relative to its left position.
float getTranslationY()
The vertical location of this view relative to its top position.
int getVerticalFadingEdgeLength()
Returns the size of the vertical faded edges used to indicate that more content in this view is visible.
int getVerticalScrollbarPosition()
int getVerticalScrollbarWidth()
Returns the width of the vertical scrollbar.
ViewTreeObserver getViewTreeObserver()
Returns the ViewTreeObserver for this view's hierarchy.
int getVisibility()
Returns the visibility status for this view.
final int getWidth()
Return the width of the your view.
int getWindowAttachCount()
WindowId getWindowId()
Retrieve the WindowId for the window this view is currently attached to.
int getWindowSystemUiVisibility()
Returns the current system UI visibility that is currently set for the entire window.
IBinder getWindowToken()
Retrieve a unique token identifying the window this view is attached to.
int getWindowVisibility()
Returns the current visibility of the window this view is attached to (either GONE, INVISIBLE, or VISIBLE).
void getWindowVisibleDisplayFrame( Rect outRect)
Retrieve the overall visible display size in which the window this view is attached to has been positioned in.
float getX()
The visual x position of this view, in pixels.
float getY()
The visual y position of this view, in pixels.
boolean hasFocus()
Returns true if this view has focus iteself, or is the ancestor of the view that has focus.
boolean hasFocusable()
Returns true if this view is focusable or if it contains a reachable View for which hasFocusable() returns true.
boolean hasOnClickListeners()
Return whether this view has an attached OnClickListener.
boolean hasOverlappingRendering()
Returns whether this View has content which overlaps.
boolean hasTransientState()
Indicates whether the view is currently tracking transient state that the app should not need to concern itself with saving and restoring, but that the framework should take special note to preserve when possible.
boolean hasWindowFocus()
Returns true if this view is in a window that currently has window focus.
static View inflate( Context context, int resource, ViewGroup root)
Inflate a view from an XML resource.
void initializeFadingEdge( TypedArray a)

Initializes the fading edges from a given set of styled attributes.

void initializeScrollbars( TypedArray a)

Initializes the scrollbars from a given set of styled attributes.

void invalidate( Rect dirty)
Mark the area defined by dirty as needing to be drawn.
void invalidate(int l, int t, int r, int b)
Mark the area defined by the rect (l,t,r,b) as needing to be drawn.
void invalidate()
Invalidate the whole view.
void invalidateDrawable( Drawable drawable)
Invalidates the specified Drawable.
boolean isActivated()
Indicates the activation state of this view.
boolean isAttachedToWindow()
Returns true if this view is currently attached to a window.
boolean isClickable()
Indicates whether this view reacts to click events or not.
boolean isDirty()
True if this view has changed since the last time being drawn.
boolean isDrawingCacheEnabled()

Indicates whether the drawing cache is enabled for this view.

boolean isDuplicateParentStateEnabled()

Indicates whether this duplicates its drawable state from its parent.

boolean isEnabled()
Returns the enabled status for this view.
final boolean isFocusable()
Returns whether this View is able to take focus.
final boolean isFocusableInTouchMode()
When a view is focusable, it may not want to take focus when in touch mode.
boolean isFocused()
Returns true if this view has focus
boolean isHapticFeedbackEnabled()
boolean isHardwareAccelerated()

Indicates whether this view is attached to a hardware accelerated window or not.

boolean isHorizontalFadingEdgeEnabled()

Indicate whether the horizontal edges are faded when the view is scrolled horizontally.

boolean isHorizontalScrollBarEnabled()

Indicate whether the horizontal scrollbar should be drawn or not.

boolean isHovered()
Returns true if the view is currently hovered.
boolean isInEditMode()
Indicates whether this View is currently in edit mode.
boolean isInLayout()
Returns whether the view hierarchy is currently undergoing a layout pass.
boolean isInTouchMode()
Returns whether the device is currently in touch mode.
boolean isLaidOut()
Returns true if this view has been through at least one layout since it was last attached to or detached from a window.
boolean isLayoutDirectionResolved()
boolean isLayoutRequested()

Indicates whether or not this view's layout will be requested during the next hierarchy layout pass.

boolean isLongClickable()
Indicates whether this view reacts to long click events or not.
boolean isOpaque()
Indicates whether this View is opaque.
boolean isPaddingOffsetRequired()
If the View draws content inside its padding and enables fading edges, it needs to support padding offsets.
boolean isPaddingRelative()
Return if the padding as been set thru relative values setPaddingRelative(int, int, int, int) or thru
boolean isPressed()
Indicates whether the view is currently in pressed state.
boolean isSaveEnabled()
Indicates whether this view will save its state (that is, whether its onSaveInstanceState() method will be called).
boolean isSaveFromParentEnabled()
Indicates whether the entire hierarchy under this view will save its state when a state saving traversal occurs from its parent.
boolean isScrollContainer()
Indicates whether this view is one of the set of scrollable containers in its window.
boolean isScrollbarFadingEnabled()
Returns true if scrollbars will fade when this view is not scrolling
boolean isSelected()
Indicates the selection state of this view.
boolean isShown()
Returns the visibility of this view and all of its ancestors
boolean isSoundEffectsEnabled()
boolean isTextAlignmentResolved()
boolean isTextDirectionResolved()
boolean isVerticalFadingEdgeEnabled()

Indicate whether the vertical edges are faded when the view is scrolled horizontally.

boolean isVerticalScrollBarEnabled()

Indicate whether the vertical scrollbar should be drawn or not.

void jumpDrawablesToCurrentState()
Call Drawable.jumpToCurrentState() on all Drawable objects associated with this view.
void layout(int l, int t, int r, int b)
Assign a size and position to a view and all of its descendants

This is the second phase of the layout mechanism.

final void measure(int widthMeasureSpec, int heightMeasureSpec)

This is called to find out how big a view should be.

static int[] mergeDrawableStates(int[] baseState, int[] additionalState)
Merge your own state values in additionalState into the base state values baseState that were returned by onCreateDrawableState(int).
void offsetLeftAndRight(int offset)
Offset this view's horizontal location by the specified amount of pixels.
void offsetTopAndBottom(int offset)
Offset this view's vertical location by the specified number of pixels.
void onAnimationEnd()
Invoked by a parent ViewGroup to notify the end of the animation currently associated with this view.
void onAnimationStart()
Invoked by a parent ViewGroup to notify the start of the animation currently associated with this view.
void onAttachedToWindow()
This is called when the view is attached to a window.
void onCancelPendingInputEvents()
Called as the result of a call to cancelPendingInputEvents() on this view or a parent view.
boolean onCheckIsTextEditor()
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.
void onConfigurationChanged( Configuration newConfig)
Called when the current configuration of the resources being used by the application have changed.
void onCreateContextMenu( ContextMenu menu)
Views should implement this if the view itself is going to add items to the context menu.
int[] onCreateDrawableState(int extraSpace)
Generate the new Drawable state for this view.
InputConnection onCreateInputConnection( EditorInfo outAttrs)
Create a new InputConnection for an InputMethod to interact with the view.
void onDetachedFromWindow()
This is called when the view is detached from a window.
void onDisplayHint(int hint)
Gives this view a hint about whether is displayed or not.
boolean onDragEvent( DragEvent event)
Handles drag events sent by the system following a call to startDrag().
void onDraw( Canvas canvas)
Implement this to do your drawing.
final void onDrawScrollBars( Canvas canvas)

Request the drawing of the horizontal and the vertical scrollbar.

boolean onFilterTouchEventForSecurity( MotionEvent event)
Filter the touch event to apply security policies.
void onFinishInflate()
Finalize inflating a view from XML.
void onFinishTemporaryDetach()
Called after onStartTemporaryDetach() when the container is done changing the view.
void onFocusChanged(boolean gainFocus, int direction, Rect previouslyFocusedRect)
Called by the view system when the focus state of this view changes.
boolean onGenericMotionEvent( MotionEvent event)
Implement this method to handle generic motion events.
void onHoverChanged(boolean hovered)
Implement this method to handle hover state changes.
boolean onHoverEvent( MotionEvent event)
Implement this method to handle hover events.
void onInitializeAccessibilityEvent( AccessibilityEvent event)
Initializes an AccessibilityEvent with information about this View which is the event source.
void onInitializeAccessibilityNodeInfo( AccessibilityNodeInfo info)
Initializes an AccessibilityNodeInfo with information about this view.
boolean onKeyDown(int keyCode, KeyEvent event)
Default implementation of KeyEvent.Callback.onKeyDown(): perform press of the view when KEYCODE_DPAD_CENTER or KEYCODE_ENTER is released, if the view is enabled and clickable.
boolean onKeyLongPress(int keyCode, KeyEvent event)
Default implementation of KeyEvent.Callback.onKeyLongPress(): always returns false (doesn't handle the event).
boolean onKeyMultiple(int keyCode, int repeatCount, KeyEvent event)
Default implementation of KeyEvent.Callback.onKeyMultiple(): always returns false (doesn't handle the event).
boolean onKeyPreIme(int keyCode, KeyEvent event)
Handle a key event before it is processed by any input method associated with the view hierarchy.
boolean onKeyShortcut(int keyCode, KeyEvent event)
Called on the focused view when a key shortcut event is not handled.
boolean onKeyUp(int keyCode, KeyEvent event)
Default implementation of KeyEvent.Callback.onKeyUp(): perform clicking of the view when KEYCODE_DPAD_CENTER or KEYCODE_ENTER is released.
void onLayout(boolean changed, int left, int top, int right, int bottom)
Called from layout when this view should assign a size and position to each of its children.
void onMeasure(int widthMeasureSpec, int heightMeasureSpec)

Measure the view and its content to determine the measured width and the measured height.

void onOverScrolled(int scrollX, int scrollY, boolean clampedX, boolean clampedY)
Called by overScrollBy(int, int, int, int, int, int, int, int, boolean) to respond to the results of an over-scroll operation.
void onPopulateAccessibilityEvent( AccessibilityEvent event)
Called from dispatchPopulateAccessibilityEvent(AccessibilityEvent) giving a chance to this View to populate the accessibility event with its text content.
void onRestoreInstanceState( Parcelable state)
Hook allowing a view to re-apply a representation of its internal state that had previously been generated by onSaveInstanceState().
void onRtlPropertiesChanged(int layoutDirection)
Called when any RTL property (layout direction or text direction or text alignment) has been changed.
Parcelable 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.
void onScreenStateChanged(int screenState)
This method is called whenever the state of the screen this view is attached to changes.
void onScrollChanged(int l, int t, int oldl, int oldt)
This is called in response to an internal scroll in this view (i.e., the view scrolled its own contents).
boolean onSetAlpha(int alpha)
Invoked if there is a Transform that involves alpha.
void onSizeChanged(int w, int h, int oldw, int oldh)
This is called during layout when the size of this view has changed.
void onStartTemporaryDetach()
This is called when a container is going to temporarily detach a child, with ViewGroup.detachViewFromParent.
boolean onTouchEvent( MotionEvent event)
Implement this method to handle touch screen motion events.
boolean onTrackballEvent( MotionEvent event)
Implement this method to handle trackball motion events.
void onVisibilityChanged( View changedView, int visibility)
Called when the visibility of the view or an ancestor of the view is changed.
void onWindowFocusChanged(boolean hasWindowFocus)
Called when the window containing this view gains or loses focus.
void onWindowSystemUiVisibilityChanged(int visible)
Override to find out when the window's requested system UI visibility has changed, that is the value returned by getWindowSystemUiVisibility().
void onWindowVisibilityChanged(int visibility)
Called when the window containing has change its visibility (between GONE, INVISIBLE, and VISIBLE).
boolean overScrollBy(int deltaX, int deltaY, int scrollX, int scrollY, int scrollRangeX, int scrollRangeY, int maxOverScrollX, int maxOverScrollY, boolean isTouchEvent)
Scroll the view with standard behavior for scrolling beyond the normal content boundaries.
boolean performAccessibilityAction(int action, Bundle arguments)
Performs the specified accessibility action on the view.
boolean performClick()
Call this view's OnClickListener, if it is defined.
boolean performHapticFeedback(int feedbackConstant)
BZZZTT!!1!

Provide haptic feedback to the user for this view.

boolean performHapticFeedback(int feedbackConstant, int flags)
BZZZTT!!1!

Like performHapticFeedback(int), with additional options.

boolean performLongClick()
Call this view's OnLongClickListener, if it is defined.
void playSoundEffect(int soundConstant)
Play a sound effect for this view.
boolean post( Runnable action)

Causes the Runnable to be added to the message queue.

boolean postDelayed( Runnable action, long delayMillis)

Causes the Runnable to be added to the message queue, to be run after the specified amount of time elapses.

void postInvalidate(int left, int top, int right, int bottom)

Cause an invalidate of the specified area to happen on a subsequent cycle through the event loop.

void postInvalidate()

Cause an invalidate to happen on a subsequent cycle through the event loop.

void postInvalidateDelayed(long delayMilliseconds, int left, int top, int right, int bottom)

Cause an invalidate of the specified area to happen on a subsequent cycle through the event loop.

void postInvalidateDelayed(long delayMilliseconds)

Cause an invalidate to happen on a subsequent cycle through the event loop.

void postInvalidateOnAnimation(int left, int top, int right, int bottom)

Cause an invalidate of the specified area to happen on the next animation time step, typically the next display frame.

void postInvalidateOnAnimation()

Cause an invalidate to happen on the next animation time step, typically the next display frame.

void postOnAnimation( Runnable action)

Causes the Runnable to execute on the next animation time step.

void postOnAnimationDelayed( Runnable action, long delayMillis)

Causes the Runnable to execute on the next animation time step, after the specified amount of time elapses.

void refreshDrawableState()
Call this to force a view to update its drawable state.
boolean removeCallbacks( Runnable action)

Removes the specified Runnable from the message queue.

void removeOnAttachStateChangeListener( View.OnAttachStateChangeListener listener)
Remove a listener for attach state changes.
void removeOnLayoutChangeListener( View.OnLayoutChangeListener listener)
Remove a listener for layout changes.
void requestFitSystemWindows()
Ask that a new dispatch of fitSystemWindows(Rect) be performed.
boolean requestFocus(int direction, Rect previouslyFocusedRect)
Call this to try to give focus to a specific view or to one of its descendants and give it hints about the direction and a specific rectangle that the focus is coming from.
final boolean requestFocus(int direction)
Call this to try to give focus to a specific view or to one of its descendants and give it a hint about what direction focus is heading.
final boolean requestFocus()
Call this to try to give focus to a specific view or to one of its descendants.
final boolean requestFocusFromTouch()
Call this to try to give focus to a specific view or to one of its descendants.
void requestLayout()
Call this when something has changed which has invalidated the layout of this view.
boolean requestRectangleOnScreen( Rect rectangle)
Request that a rectangle of this view be visible on the screen, scrolling if necessary just enough.
boolean requestRectangleOnScreen( Rect rectangle, boolean immediate)
Request that a rectangle of this view be visible on the screen, scrolling if necessary just enough.
static int resolveSize(int size, int measureSpec)
Version of resolveSizeAndState(int, int, int) returning only the MEASURED_SIZE_MASK bits of the result.
static int resolveSizeAndState(int size, int measureSpec, int childMeasuredState)
Utility to reconcile a desired size and state, with constraints imposed by a MeasureSpec.
void restoreHierarchyState( SparseArray< Parcelable> container)
Restore this view hierarchy's frozen state from the given container.
void saveHierarchyState( SparseArray< Parcelable> container)
Store this view hierarchy's frozen state into the given container.
void scheduleDrawable( Drawable who, Runnable what, long when)
Schedules an action on a drawable to occur at a specified time.
void scrollBy(int x, int y)
Move the scrolled position of your view.
void scrollTo(int x, int y)
Set the scrolled position of your view.
void sendAccessibilityEvent(int eventType)
Sends an accessibility event of the given type.
void sendAccessibilityEventUnchecked( AccessibilityEvent event)
This method behaves exactly as sendAccessibilityEvent(int) but takes as an argument an empty AccessibilityEvent and does not perform a check whether accessibility is enabled.
void setAccessibilityDelegate( View.AccessibilityDelegate delegate)
Sets a delegate for implementing accessibility support via composition as opposed to inheritance.
void setAccessibilityLiveRegion(int mode)
Sets the live region mode for this view.
void setActivated(boolean activated)
Changes the activated state of this view.
void setAlpha(float alpha)

Sets the opacity of the view.

void setAnimation( Animation animation)
Sets the next animation to play for this view.
void setBackground( Drawable background)
Set the background to a given Drawable, or remove the background.
void setBackgroundColor(int color)
Sets the background color for this view.
void setBackgroundDrawable( Drawable background)
This method was deprecated in API level 16. use setBackground(Drawable) instead
void setBackgroundResource(int resid)
Set the background to a given resource.
final void setBottom(int bottom)
Sets the bottom position of this view relative to its parent.
void setCameraDistance(float distance)

Sets the distance along the Z axis (orthogonal to the X/Y plane on which views are drawn) from the camera to this view.

void setClickable(boolean clickable)
Enables or disables click events for this view.
void setClipBounds( Rect clipBounds)
Sets a rectangular area on this view to which the view will be clipped when it is drawn.
void setContentDescription( CharSequence contentDescription)
Sets the View description.
void setDrawingCacheBackgroundColor(int color)
Setting a solid background color for the drawing cache's bitmaps will improve performance and memory usage.
void setDrawingCacheEnabled(boolean enabled)

Enables or disables the drawing cache.

void setDrawingCacheQuality(int quality)
Set the drawing cache quality of this view.
void setDuplicateParentStateEnabled(boolean enabled)

Enables or disables the duplication of the parent's state into this view.

void setEnabled(boolean enabled)
Set the enabled state of this view.
void setFadingEdgeLength(int length)
Set the size of the faded edge used to indicate that more content in this view is available.
void setFilterTouchesWhenObscured(boolean enabled)
Sets whether the framework should discard touches when the view's window is obscured by another visible window.
void setFitsSystemWindows(boolean fitSystemWindows)
Sets whether or not this view should account for system screen decorations such as the status bar and inset its content; that is, controlling whether the default implementation of fitSystemWindows(Rect) will be executed.
void setFocusable(boolean focusable)
Set whether this view can receive the focus.
void setFocusableInTouchMode(boolean focusableInTouchMode)
Set whether this view can receive focus while in touch mode.
void setHapticFeedbackEnabled(boolean hapticFeedbackEnabled)
Set whether this view should have haptic feedback for events such as long presses.
void setHasTransientState(boolean hasTransientState)
Set whether this view is currently tracking transient state that the framework should attempt to preserve when possible.
void setHorizontalFadingEdgeEnabled(boolean horizontalFadingEdgeEnabled)

Define whether the horizontal edges should be faded when this view is scrolled horizontally.

void setHorizontalScrollBarEnabled(boolean horizontalScrollBarEnabled)

Define whether the horizontal scrollbar should be drawn or not.

void setHovered(boolean hovered)
Sets whether the view is currently hovered.
void setId(int id)
Sets the identifier for this view.
void setImportantForAccessibility(int mode)
Sets how to determine whether this view is important for accessibility which is if it fires accessibility events and if it is reported to accessibility services that query the screen.
void setKeepScreenOn(boolean keepScreenOn)
Controls whether the screen should remain on, modifying the value of KEEP_SCREEN_ON.
void setLabelFor(int id)
Sets the id of a view for which this view serves as a label for accessibility purposes.
void setLayerPaint( Paint paint)
Updates the Paint object used with the current layer (used only if the current layer type is not set to LAYER_TYPE_NONE).
void setLayerType(int layerType, Paint paint)

Specifies the type of layer backing this view.

void setLayoutDirection(int layoutDirection)
Set the layout direction for this view.
void setLayoutParams( ViewGroup.LayoutParams params)
Set the layout parameters associated with this view.
final void setLeft(int left)
Sets the left position of this view relative to its parent.
void setLongClickable(boolean longClickable)
Enables or disables long click events for this view.
final void setMeasuredDimension(int measuredWidth, int measuredHeight)

This method must be called by onMeasure(int, int) to store the measured width and measured height.

void setMinimumHeight(int minHeight)
Sets the minimum height of the view.
void setMinimumWidth(int minWidth)
Sets the minimum width of the view.
void setNextFocusDownId(int nextFocusDownId)
Sets the id of the view to use when the next focus is FOCUS_DOWN.
void setNextFocusForwardId(int nextFocusForwardId)
Sets the id of the view to use when the next focus is FOCUS_FORWARD.
void setNextFocusLeftId(int nextFocusLeftId)
Sets the id of the view to use when the next focus is FOCUS_LEFT.
void setNextFocusRightId(int nextFocusRightId)
Sets the id of the view to use when the next focus is FOCUS_RIGHT.
void setNextFocusUpId(int nextFocusUpId)
Sets the id of the view to use when the next focus is FOCUS_UP.
void setOnClickListener( View.OnClickListener l)
Register a callback to be invoked when this view is clicked.
void setOnCreateContextMenuListener( View.OnCreateContextMenuListener l)
Register a callback to be invoked when the context menu for this view is being built.
void setOnDragListener( View.OnDragListener l)
Register a drag event listener callback object for this View.
void setOnFocusChangeListener( View.OnFocusChangeListener l)
Register a callback to be invoked when focus of this view changed.
void setOnGenericMotionListener( View.OnGenericMotionListener l)
Register a callback to be invoked when a generic motion event is sent to this view.
void setOnHoverListener( View.OnHoverListener l)
Register a callback to be invoked when a hover event is sent to this view.
void setOnKeyListener( View.OnKeyListener l)
Register a callback to be invoked when a hardware key is pressed in this view.
void setOnLongClickListener( View.OnLongClickListener l)
Register a callback to be invoked when this view is clicked and held.
void setOnSystemUiVisibilityChangeListener( View.OnSystemUiVisibilityChangeListener l)
Set a listener to receive callbacks when the visibility of the system bar changes.
void setOnTouchListener( View.OnTouchListener l)
Register a callback to be invoked when a touch event is sent to this view.
void setOverScrollMode(int overScrollMode)
Set the over-scroll mode for this view.
void setPadding(int left, int top, int right, int bottom)
Sets the padding.
void setPaddingRelative(int start, int top, int end, int bottom)
Sets the relative padding.
void setPivotX(float pivotX)
Sets the x location of the point around which the view is rotated and scaled.
void setPivotY(float pivotY)
Sets the y location of the point around which the view is rotated and scaled.
void setPressed(boolean pressed)
Sets the pressed state for this view.
final void setRight(int right)
Sets the right position of this view relative to its parent.
void setRotation(float rotation)
Sets the degrees that the view is rotated around the pivot point.
void setRotationX(float rotationX)
Sets the degrees that the view is rotated around the horizontal axis through the pivot point.
void setRotationY(float rotationY)
Sets the degrees that the view is rotated around the vertical axis through the pivot point.
void setSaveEnabled(boolean enabled)
Controls whether the saving of this view's state is enabled (that is, whether its onSaveInstanceState() method will be called).
void setSaveFromParentEnabled(boolean enabled)
Controls whether the entire hierarchy under this view will save its state when a state saving traversal occurs from its parent.
void setScaleX(float scaleX)
Sets the amount that the view is scaled in x around the pivot point, as a proportion of the view's unscaled width.
void setScaleY(float scaleY)
Sets the amount that the view is scaled in Y around the pivot point, as a proportion of the view's unscaled width.
void setScrollBarDefaultDelayBeforeFade(int scrollBarDefaultDelayBeforeFade)
Define the delay before scrollbars fade.
void setScrollBarFadeDuration(int scrollBarFadeDuration)
Define the scrollbar fade duration.
void setScrollBarSize(int scrollBarSize)
Define the scrollbar size.
void setScrollBarStyle(int style)

Specify the style of the scrollbars.

void setScrollContainer(boolean isScrollContainer)
Change whether this view is one of the set of scrollable containers in its window.
void setScrollX(int value)
Set the horizontal scrolled position of your view.
void setScrollY(int value)
Set the vertical scrolled position of your view.
void setScrollbarFadingEnabled(boolean fadeScrollbars)
Define whether scrollbars will fade when the view is not scrolling.
void setSelected(boolean selected)
Changes the selection state of this view.
void setSoundEffectsEnabled(boolean soundEffectsEnabled)
Set whether this view should have sound effects enabled for events such as clicking and touching.
void setSystemUiVisibility(int visibility)
Request that the visibility of the status bar or other screen/window decorations be changed.
void setTag(int key, Object tag)
Sets a tag associated with this view and a key.
void setTag( Object tag)
Sets the tag associated with this view.
void setTextAlignment(int textAlignment)
Set the text alignment.
void setTextDirection(int textDirection)
Set the text direction.
final void setTop(int top)
Sets the top position of this view relative to its parent.
void setTouchDelegate( TouchDelegate delegate)
Sets the TouchDelegate for this View.
void setTranslationX(float translationX)
Sets the horizontal location of this view relative to its left position.
void setTranslationY(float translationY)
Sets the vertical location of this view relative to its top position.
void setVerticalFadingEdgeEnabled(boolean verticalFadingEdgeEnabled)

Define whether the vertical edges should be faded when this view is scrolled vertically.

void setVerticalScrollBarEnabled(boolean verticalScrollBarEnabled)

Define whether the vertical scrollbar should be drawn or not.

void setVerticalScrollbarPosition(int position)
Set the position of the vertical scroll bar.
void setVisibility(int visibility)
Set the enabled state of this view.
void setWillNotCacheDrawing(boolean willNotCacheDrawing)
When a View's drawing cache is enabled, drawing is redirected to an offscreen bitmap.
void setWillNotDraw(boolean willNotDraw)
If this view doesn't do any drawing on its own, set this flag to allow further optimizations.
void setX(float x)
Sets the visual x position of this view, in pixels.
void setY(float y)
Sets the visual y position of this view, in pixels.
boolean showContextMenu()
Bring up the context menu for this view.
ActionMode startActionMode( ActionMode.Callback callback)
Start an action mode.
void startAnimation( Animation animation)
Start the specified animation now.
final boolean startDrag( ClipData data, View.DragShadowBuilder shadowBuilder, Object myLocalState, int flags)
Starts a drag and drop operation.
String toString()
Returns a string containing a concise, human-readable description of this object.
void unscheduleDrawable( Drawable who)
Unschedule any events associated with the given Drawable.
void unscheduleDrawable( Drawable who, Runnable what)
Cancels a scheduled action on a drawable.
boolean verifyDrawable( Drawable who)
If your view subclass is displaying its own Drawable objects, it should override this function and return true for any Drawable it is displaying.
boolean willNotCacheDrawing()
Returns whether or not this View can cache its drawing or not.
boolean willNotDraw()
Returns whether or not this View draws on its own.
From class java.lang.Object
Object clone()
Creates and returns a copy of this Object.
boolean equals( Object o)
Compares this instance with the specified object and indicates if they are equal.
void finalize()
Invoked when the garbage collector has detected that this instance is no longer reachable.
final Class<?> getClass()
Returns the unique instance of Class that represents this object's class.
int hashCode()
Returns an integer hash code for this object.
final void notify()
Causes a thread which is waiting on this object's monitor (by means of calling one of the wait() methods) to be woken up.
final void notifyAll()
Causes all threads which are waiting on this object's monitor (by means of calling one of the wait() methods) to be woken up.
String toString()
Returns a string containing a concise, human-readable description of this object.
final void wait()
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object.
final void wait(long millis, int nanos)
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the specified timeout expires.
final void wait(long millis)
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the specified timeout expires.
From interface android.graphics.drawable.Drawable.Callback
abstract void invalidateDrawable( Drawable who)
Called when the drawable needs to be redrawn.
abstract void scheduleDrawable( Drawable who, Runnable what, long when)
A Drawable can call this to schedule the next frame of its animation.
abstract void unscheduleDrawable( Drawable who, Runnable what)
A Drawable can call this to unschedule an action previously scheduled with scheduleDrawable(Drawable, Runnable, long).
From interface android.view.KeyEvent.Callback
abstract boolean onKeyDown(int keyCode, KeyEvent event)
Called when a key down event has occurred.
abstract boolean onKeyLongPress(int keyCode, KeyEvent event)
Called when a long press has occurred.
abstract boolean onKeyMultiple(int keyCode, int count, KeyEvent event)
Called when multiple down/up pairs of the same key have occurred in a row.
abstract boolean onKeyUp(int keyCode, KeyEvent event)
Called when a key up event has occurred.
From interface android.view.ViewTreeObserver.OnPreDrawListener
abstract boolean onPreDraw()
Callback method to be invoked when the view tree is about to be drawn.
From interface android.view.accessibility.AccessibilityEventSource
abstract void sendAccessibilityEvent(int eventType)
Handles the request for sending an AccessibilityEvent given the event type.
abstract void sendAccessibilityEventUnchecked( AccessibilityEvent event)
Handles the request for sending an AccessibilityEvent.
From interface android.widget.Filter.FilterListener
abstract void onFilterComplete(int count)

Notifies the end of a filtering operation.

XML Attributes


android:completionHint

Defines the hint displayed in the drop down menu.

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 completionHint.

android:completionHintView

Defines the hint view displayed in the drop down menu.

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 completionHintView.

Related Methods

    android:completionThreshold

    Defines the number of characters that the user must type before completion suggestions are displayed in a drop down menu.

    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 completionThreshold.

    Related Methods

    android:dropDownAnchor

    View to anchor the auto-complete dropdown to. If not specified, the text view itself is used.

    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 dropDownAnchor.

    Related Methods

    android:dropDownHeight

    Specifies the basic height of the dropdown. Its value may be a dimension (such as "12dip") for a constant height, fill_parent or match_parent to fill the height of the screen, or wrap_content to match the height of the content of the drop down.

    May 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.

    May be one of the following constant values.

    ConstantValueDescription
    fill_parent-1The dropdown should fit the height of the screen. This constant is deprecated starting from API Level 8 and is replaced by match_parent.
    match_parent-1The dropdown should fit the height of the screen. Introduced in API Level 8.
    wrap_content-2The dropdown should fit the height of the content.

    This corresponds to the global attribute resource symbol dropDownHeight.

    Related Methods

    android:dropDownHorizontalOffset

    Amount of pixels by which the drop down should be offset horizontally.

    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 dropDownHorizontalOffset.

    Related Methods

      android:dropDownSelector

      Selector in a drop down list.

      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 dropDownSelector.

      Related Methods

        android:dropDownVerticalOffset

        Amount of pixels by which the drop down should be offset vertically.

        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 dropDownVerticalOffset.

        Related Methods

          android:dropDownWidth

          Specifies the basic width of the dropdown. Its value may be a dimension (such as "12dip") for a constant width, fill_parent or match_parent to match the width of the screen, or wrap_content to match the width of the anchored view.

          May 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.

          May be one of the following constant values.

          ConstantValueDescription
          fill_parent-1The dropdown should fill the width of the screen. This constant is deprecated starting from API Level 8 and is replaced by match_parent.
          match_parent-1The dropdown should fit the width of the screen. Introduced in API Level 8.
          wrap_content-2The dropdown should fit the width of its anchor.

          This corresponds to the global attribute resource symbol dropDownWidth.

          Related Methods

          android:popupBackground

          Public Constructors


          public AutoCompleteTextView (Context context)
          Added in API level 1

          public AutoCompleteTextView (Context context, AttributeSet attrs)
          Added in API level 1

          public AutoCompleteTextView (Context context, AttributeSet attrs, int defStyle)
          Added in API level 1

          Public Methods


          public void clearListSelection ()
          Added in API level 3

          Clear the list selection. This may only be temporary, as user input will often bring it back.

          public void dismissDropDown ()
          Added in API level 1

          Closes the drop down if present on screen.

          public boolean enoughToFilter ()
          Added in API level 1

          Returns true if the amount of text in the field meets or exceeds the getThreshold() requirement. You can override this to impose a different standard for when filtering will be triggered.

          public ListAdapter getAdapter ()
          Added in API level 1

          Returns a filterable list adapter used for auto completion.

          Returns
          • a data adapter used for auto completion

          public CharSequence getCompletionHint ()
          Added in API level 16

          Gets the optional hint text displayed at the bottom of the the matching list.

          Related XML Attributes
          Returns
          • The hint text, if any

          public int getDropDownAnchor ()
          Added in API level 3

          Returns the id for the view that the auto-complete drop down list is anchored to.

          Related XML Attributes
          Returns
          • the view's id, or NO_ID if none specified

          public Drawable getDropDownBackground ()
          Added in API level 5

          Gets the background of the auto-complete drop-down list.

          Related XML Attributes
          Returns
          • the background drawable

          public int getDropDownHeight ()
          Added in API level 4

          Returns the current height for the auto-complete drop down list. This can be a fixed height, or MATCH_PARENT to fill the screen, or WRAP_CONTENT to fit the height of the drop down's content.

          Related XML Attributes
          Returns
          • the height for the drop down list

          public int getDropDownHorizontalOffset ()
          Added in API level 5

          Gets the horizontal offset used for the auto-complete drop-down list.

          Returns
          • the horizontal offset

          public int getDropDownVerticalOffset ()
          Added in API level 5

          Gets the vertical offset used for the auto-complete drop-down list.

          Returns
          • the vertical offset

          public int getDropDownWidth ()
          Added in API level 3

          Returns the current width for the auto-complete drop down list. This can be a fixed width, or MATCH_PARENT to fill the screen, or WRAP_CONTENT to fit the width of its anchor view.

          Related XML Attributes
          Returns
          • the width for the drop down list

          public AdapterView.OnItemClickListener getItemClickListener ()
          Added in API level 1

          This method was deprecated in API level 3.
          Use getOnItemClickListener() intead

          Returns the listener that is notified whenever the user clicks an item in the drop down list.

          Returns
          • the item click listener

          public AdapterView.OnItemSelectedListener getItemSelectedListener ()
          Added in API level 1

          This method was deprecated in API level 3.
          Use getOnItemSelectedListener() intead

          Returns the listener that is notified whenever the user selects an item in the drop down list.

          Returns
          • the item selected listener

          public int getListSelection ()
          Added in API level 3

          Get the position of the dropdown view selection, if there is one. Returns ListView.INVALID_POSITION if there is no dropdown or if there is no selection.

          Returns

          public AdapterView.OnItemClickListener getOnItemClickListener ()
          Added in API level 3

          Returns the listener that is notified whenever the user clicks an item in the drop down list.

          Returns
          • the item click listener

          public AdapterView.OnItemSelectedListener getOnItemSelectedListener ()
          Added in API level 3

          Returns the listener that is notified whenever the user selects an item in the drop down list.

          Returns
          • the item selected listener

          public int getThreshold ()
          Added in API level 1

          Returns the number of characters the user must type before the drop down list is shown.

          Related XML Attributes
          Returns
          • the minimum number of characters to type to show the drop down

          public boolean isPerformingCompletion ()
          Added in API level 3

          Identifies whether the view is currently performing a text completion, so subclasses can decide whether to respond to text changed events.

          public boolean isPopupShowing ()
          Added in API level 1

          Indicates whether the popup menu is showing.

          Returns
          • true if the popup menu is showing, false otherwise

          public void onCommitCompletion (CompletionInfo completion)
          Added in API level 3

          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
          completion The auto complete text the user has selected.

          public void onFilterComplete (int count)
          Added in API level 1

          Notifies the end of a filtering operation.

          Parameters
          count the number of values computed by the filter

          public boolean onKeyDown (int keyCode, KeyEvent event)
          Added in API level 1

          Default implementation of KeyEvent.Callback.onKeyDown(): perform press of the view when KEYCODE_DPAD_CENTER or 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.

          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.

          public boolean onKeyPreIme (int keyCode, KeyEvent event)
          Added in API level 3

          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.

          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.

          public boolean onKeyUp (int keyCode, KeyEvent event)
          Added in API level 1

          Default implementation of KeyEvent.Callback.onKeyUp(): perform clicking of the view when KEYCODE_DPAD_CENTER or 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.

          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.

          public void onWindowFocusChanged (boolean hasWindowFocus)
          Added in API level 1

          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.

          Parameters
          hasWindowFocus True if the window containing this view now has focus, false otherwise.

          public void performCompletion ()
          Added in API level 1

          Performs the text completion by converting the selected item from the drop down list into a string, replacing the text box's content with this string and finally dismissing the drop down menu.

          public void performValidation ()
          Added in API level 1

          If a validator was set on this view and the current string is not valid, ask the validator to fix it.

          public void setAdapter (T adapter)
          Added in API level 1

          Changes the list of data used for auto completion. The provided list must be a filterable list adapter.

          The caller is still responsible for managing any resources used by the adapter. Notably, when the AutoCompleteTextView is closed or released, the adapter is not notified. A common case is the use of CursorAdapter, which contains a Cursor that must be closed. This can be done automatically (see startManagingCursor()), or by manually closing the cursor when the AutoCompleteTextView is dismissed.

          Parameters
          adapter the adapter holding the auto completion data

          public void setCompletionHint (CharSequence hint)
          Added in API level 1

          Sets the optional hint text that is displayed at the bottom of the the matching list. This can be used as a cue to the user on how to best use the list, or to provide extra information.

          Related XML Attributes
          Parameters
          hint the text to be displayed to the user

          public void setDropDownAnchor (int id)
          Added in API level 3

          Sets the view to which the auto-complete drop down list should anchor. The view corresponding to this id will not be loaded until the next time it is needed to avoid loading a view which is not yet instantiated.

          Related XML Attributes
          Parameters
          id the id to anchor the drop down list view to

          public void setDropDownBackgroundDrawable (Drawable d)
          Added in API level 5

          Sets the background of the auto-complete drop-down list.

          Related XML Attributes
          Parameters
          d the drawable to set as the background

          public void setDropDownBackgroundResource (int id)
          Added in API level 5

          Sets the background of the auto-complete drop-down list.

          Related XML Attributes
          Parameters
          id the id of the drawable to set as the background

          public void setDropDownHeight (int height)
          Added in API level 4

          Sets the current height for the auto-complete drop down list. This can be a fixed height, or MATCH_PARENT to fill the screen, or WRAP_CONTENT to fit the height of the drop down's content.

          Related XML Attributes
          Parameters
          height the height to use

          public void setDropDownHorizontalOffset (int offset)
          Added in API level 5

          Sets the horizontal offset used for the auto-complete drop-down list.

          Parameters
          offset the horizontal offset

          public void setDropDownVerticalOffset (int offset)
          Added in API level 5

          Sets the vertical offset used for the auto-complete drop-down list.

          Parameters
          offset the vertical offset

          public void setDropDownWidth (int width)
          Added in API level 3

          Sets the current width for the auto-complete drop down list. This can be a fixed width, or MATCH_PARENT to fill the screen, or WRAP_CONTENT to fit the width of its anchor view.

          Related XML Attributes
          Parameters
          width the width to use

          public void setListSelection (int position)
          Added in API level 3

          Set the position of the dropdown view selection.

          Parameters
          position The position to move the selector to.

          public void setOnClickListener (View.OnClickListener listener)
          Added in API level 1

          Register a callback to be invoked when this view is clicked. If this view is not clickable, it becomes clickable.

          Parameters
          listener The callback that will run

          public void setOnDismissListener (AutoCompleteTextView.OnDismissListener dismissListener)
          Added in API level 17

          Set a listener that will be invoked whenever the AutoCompleteTextView's list of completions is dismissed.

          Parameters
          dismissListener Listener to invoke when completions are dismissed

          public void setOnItemClickListener (AdapterView.OnItemClickListener l)
          Added in API level 1

          Sets the listener that will be notified when the user clicks an item in the drop down list.

          Parameters
          l the item click listener

          public void setOnItemSelectedListener (AdapterView.OnItemSelectedListener l)
          Added in API level 1

          Sets the listener that will be notified when the user selects an item in the drop down list.

          Parameters
          l the item selected listener

          public void setText (CharSequence text, boolean filter)
          Added in API level 17

          Like setText(CharSequence), except that it can disable filtering.

          Parameters
          filter If false, no filtering will be performed as a result of this call.

          public void setThreshold (int threshold)
          Added in API level 1

          Specifies the minimum number of characters the user has to type in the edit box before the drop down list is shown.

          When threshold is less than or equals 0, a threshold of 1 is applied.

          Related XML Attributes
          Parameters
          threshold the number of characters to type before the drop down is shown
          See Also

          public void setValidator (AutoCompleteTextView.Validator validator)
          Added in API level 1

          Sets the validator used to perform text validation.

          Parameters
          validator The validator used to validate the text entered in this widget.

          public void showDropDown ()
          Added in API level 1

          Displays the drop down on screen.

          Protected Methods


          protected CharSequence convertSelectionToString (Object selectedItem)
          Added in API level 1

          Converts the selected item from the drop down list into a sequence of character that can be used in the edit box.

          Parameters
          selectedItem the item selected by the user for completion
          Returns
          • a sequence of characters representing the selected suggestion

          protected Filter getFilter ()
          Added in API level 1

          Returns the Filter obtained from getFilter(), or null if setAdapter(T) was not called with a Filterable.

          protected void onAttachedToWindow ()
          Added in API level 1

          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(android.graphics.Canvas), however it may be called any time before the first onDraw -- including before or after onMeasure(int, int).

          protected void onDetachedFromWindow ()
          Added in API level 1

          This is called when the view is detached from a window. At this point it no longer has a surface for drawing.

          protected void onDisplayHint (int hint)
          Added in API level 8

          Gives this view a hint about whether is displayed or not. For instance, when a View moves out of the screen, it might receives a display hint indicating the view is not displayed. Applications should not rely on this hint as there is no guarantee that they will receive one.

          Parameters
          hint A hint about whether or not this view is displayed: VISIBLE or INVISIBLE.

          protected void onFocusChanged (boolean focused, int direction, Rect previouslyFocusedRect)
          Added in API level 1

          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.

          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 FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_FORWARD, or 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.

          protected void performFiltering (CharSequence text, int keyCode)
          Added in API level 1

          Starts filtering the content of the drop down list. The filtering pattern is the content of the edit box. Subclasses should override this method to filter with a different pattern, for instance a substring of text.

          Parameters
          text the filtering pattern
          keyCode the last character inserted in the edit box; beware that this will be null when text is being added through a soft input method.

          protected void replaceText (CharSequence text)
          Added in API level 1

          Performs the text completion by replacing the current text by the selected item. Subclasses should override this method to avoid replacing the whole content of the edit box.

          Parameters
          text the selected suggestion in the drop down list

          protected boolean setFrame (int l, int t, int r, int b)
          Added in API level 1

          Assign a size and position to this view. This is called from layout.

          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

           

           

           

           

          使用方法如下:

          public class CountriesActivity extends Activity { 
               
          protected void onCreate(Bundle icicle) { 
                   
          super.onCreate(icicle); 
                   setContentView
          (R.layout.countries); 
           
                   
          ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, 
                           android
          .R.layout.simple_dropdown_item_1line, COUNTRIES); 
                   
          AutoCompleteTextView textView = (AutoCompleteTextView) 
                           findViewById
          (R.id.countries_list); 
                   textView
          .setAdapter(adapter); 
               
          } 
           
               
          private static final String[] COUNTRIES = new String[] { 
                   
          "Belgium", "France", "Italy", "Germany", "Spain" 
               
          }; 
           
          } 
           

          在AutoCompleteTextview的使用中关键是Adapter的构建和应用
          评论
          添加红包

          请填写红包祝福语或标题

          红包个数最小为10个

          红包金额最低5元

          当前余额3.43前往充值 >
          需支付:10.00
          成就一亿技术人!
          领取后你会自动成为博主和红包主的粉丝 规则
          hope_wisdom
          发出的红包
          实付
          使用余额支付
          点击重新获取
          扫码支付
          钱包余额 0

          抵扣说明:

          1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
          2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

          余额充值