java.lang.Object | |
↳ | android.view.View |
![]() |
![]()
AbsListView,
AbsSeekBar,
AbsSpinner,
AbsoluteLayout,
ActionMenuView,
AdapterView<T extends Adapter>,
AdapterViewAnimator,
AdapterViewFlipper,
and
99 others.
|
This class represents the basic building block for user interface components. A View
occupies a rectangular area on the screen and is responsible for drawing and
event handling. View is the base class for widgets, which are
used to create interactive UI components (buttons, text fields, etc.). The
ViewGroup
subclass is the base class for layouts, which
are invisible containers that hold other Views (or other ViewGroups) and define
their layout properties.
For information about using this class to develop your application's user interface, read the User Interface developer guide.
All of the views in a window are arranged in a single tree. You can add views either from code or by specifying a tree of views in one or more XML layout files. There are many specialized subclasses of views that act as controls or are capable of displaying text, images, or other content.
Once you have created a tree of views, there are typically a few types of common operations you may wish to perform:
TextView
. The available properties and the methods
that set them will vary among the different subclasses of views. Note that
properties that are known at build time can be set in the XML layout
files.requestFocus()
.setOnFocusChangeListener(android.view.View.OnFocusChangeListener)
.
Other view subclasses offer more specialized listeners. For example, a Button
exposes a listener to notify clients when the button is clicked.setVisibility(int)
.
Note: The Android framework is responsible for measuring, laying out and
drawing views. You should not call methods that perform these actions on
views yourself unless you are actually implementing a
ViewGroup
.
To implement a custom view, you will usually begin by providing overrides for
some of the standard methods that the framework calls on all views. You do
not need to override all of these methods. In fact, you can start by just
overriding onDraw(android.graphics.Canvas)
.
Category | Methods | Description |
---|---|---|
Creation | Constructors | There is a form of the constructor that are called when the view is created from code and a form that is called when the view is inflated from a layout file. The second form should parse and apply any attributes defined in the layout file. |
|
Called after a view and all of its children has been inflated from XML. | |
Layout |
|
Called to determine the size requirements for this view and all of its children. |
|
Called when this view should assign a size and position to all of its children. | |
|
Called when the size of this view has changed. | |
Drawing |
|
Called when the view should render its content. |
Event processing |
|
Called when a new hardware key event occurs. |
|
Called when a hardware key up event occurs. | |
|
Called when a trackball motion event occurs. | |
|
Called when a touch screen motion event occurs. | |
Focus |
|
Called when the view gains or loses focus. |
|
Called when the window containing the view gains or loses focus. | |
Attaching |
|
Called when the view is attached to a window. |
|
Called when the view is detached from its window. | |
|
Called when the visibility of the window containing the view has changed. |
<Button android:id="@+id/my_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/my_button_text"/>
Button myButton = (Button) findViewById(R.id.my_button);
View IDs need not be unique throughout the tree, but it is good practice to ensure that they are at least unique within the part of the tree you are searching.
The geometry of a view is that of a rectangle. A view has a location, expressed as a pair of left and top coordinates, and two dimensions, expressed as a width and a height. The unit for location and dimensions is the pixel.
It is possible to retrieve the location of a view by invoking the methods
getLeft()
and getTop()
. The former returns the left, or X,
coordinate of the rectangle representing the view. The latter returns the
top, or Y, coordinate of the rectangle representing the view. These methods
both return the location of the view relative to its parent. For instance,
when getLeft() returns 20, that means the view is located 20 pixels to the
right of the left edge of its direct parent.
In addition, several convenience methods are offered to avoid unnecessary
computations, namely getRight()
and getBottom()
.
These methods return the coordinates of the right and bottom edges of the
rectangle representing the view. For instance, calling getRight()
is similar to the following computation: getLeft() + getWidth()
(see Size for more information about the width.)
The size of a view is expressed with a width and a height. A view actually possess two pairs of width and height values.
The first pair is known as measured width and
measured height. These dimensions define how big a view wants to be
within its parent (see Layout for more details.) The
measured dimensions can be obtained by calling getMeasuredWidth()
and getMeasuredHeight()
.
The second pair is simply known as width and height, or
sometimes drawing width and drawing height. These
dimensions define the actual size of the view on screen, at drawing time and
after layout. These values may, but do not have to, be different from the
measured width and height. The width and height can be obtained by calling
getWidth()
and getHeight()
.
To measure its dimensions, a view takes into account its padding. The padding
is expressed in pixels for the left, top, right and bottom parts of the view.
Padding can be used to offset the content of the view by a specific amount of
pixels. For instance, a left padding of 2 will push the view's content by
2 pixels to the right of the left edge. Padding can be set using the
setPadding(int, int, int, int)
or setPaddingRelative(int, int, int, int)
method and queried by calling getPaddingLeft()
, getPaddingTop()
,
getPaddingRight()
, getPaddingBottom()
, getPaddingStart()
,
getPaddingEnd()
.
Even though a view can define a padding, it does not provide any support for
margins. However, view groups provide such a support. Refer to
ViewGroup
and
ViewGroup.MarginLayoutParams
for further information.
Layout is a two pass process: a measure pass and a layout pass. The measuring
pass is implemented in measure(int, int)
and is a top-down traversal
of the view tree. Each view pushes dimension specifications down the tree
during the recursion. At the end of the measure pass, every view has stored
its measurements. The second pass happens in
layout(int, int, int, int)
and is also top-down. During
this pass each parent is responsible for positioning all of its children
using the sizes computed in the measure pass.
When a view's measure() method returns, its getMeasuredWidth()
and
getMeasuredHeight()
values must be set, along with those for all of
that view's descendants. A view's measured width and measured height values
must respect the constraints imposed by the view's parents. This guarantees
that at the end of the measure pass, all parents accept all of their
children's measurements. A parent view may call measure() more than once on
its children. For example, the parent may measure each child once with
unspecified dimensions to find out how big they want to be, then call
measure() on them again with actual numbers if the sum of all the children's
unconstrained sizes is too big or too small.
The measure pass uses two classes to communicate dimensions. The
View.MeasureSpec
class is used by views to tell their parents how they
want to be measured and positioned. The base LayoutParams class just
describes how big the view wants to be for both width and height. For each
dimension, it can specify one of:
MeasureSpecs are used to push requirements down the tree from parent to child. A MeasureSpec can be in one of three modes:
To initiate a layout, call requestLayout()
. This method is typically
called by a view on itself when it believes that is can no longer fit within
its current bounds.
Drawing is handled by walking the tree and recording the drawing commands of any View that needs to update. After this, the drawing commands of the entire tree are issued to screen, clipped to the newly damaged area.
The tree is largely recorded and drawn in order, with parents drawn before
(i.e., behind) their children, with siblings drawn in the order they appear
in the tree. If you set a background drawable for a View, then the View will
draw it before calling back to its onDraw()
method. The child
drawing order can be overridden with
custom child drawing order
in a ViewGroup, and with setZ(float)
custom Z values} set on Views.
To force a view to draw, call invalidate()
.
The basic cycle of a view is as follows:
requestLayout()
.invalidate()
.requestLayout()
or invalidate()
were called,
the framework will take care of measuring, laying out, and drawing the tree
as appropriate.Note: The entire view tree is single threaded. You must always be on
the UI thread when calling any method on any view.
If you are doing work on other threads and want to update the state of a view
from that thread, you should use a Handler
.
The framework will handle routine focus movement in response to user input.
This includes changing the focus as views are removed or hidden, or as new
views become available. Views indicate their willingness to take focus
through the isFocusable()
method. To change whether a view can take
focus, call setFocusable(boolean)
. When in touch mode (see notes below)
views indicate whether they still would like focus via isFocusableInTouchMode()
and can change this via setFocusableInTouchMode(boolean)
.
Focus movement is based on an algorithm which finds the nearest neighbor in a given direction. In rare cases, the default algorithm may not match the intended behavior of the developer. In these situations, you can provide explicit overrides by using these XML attributes in the layout file:
nextFocusDown nextFocusLeft nextFocusRight nextFocusUp
To get a particular view to take focus, call requestFocus()
.
When a user is navigating a user interface via directional keys such as a D-pad, it is necessary to give focus to actionable items such as buttons so the user can see what will take input. If the device has touch capabilities, however, and the user begins interacting with the interface by touching it, it is no longer necessary to always highlight, or give focus to, a particular view. This motivates a mode for interaction named 'touch mode'.
For a touch capable device, once the user touches the screen, the device
will enter touch mode. From this point onward, only views for which
isFocusableInTouchMode()
is true will be focusable, such as text editing widgets.
Other views that are touchable, like buttons, will not take focus when touched; they will
only fire the on click listeners.
Any time a user hits a directional key, such as a D-pad direction, the view device will exit touch mode, and find a view to take focus, so that the user may resume interacting with the user interface without touching the screen again.
The touch mode state is maintained across Activity
s. Call
isInTouchMode()
to see whether the device is currently in touch mode.
The framework provides basic support for views that wish to internally
scroll their content. This includes keeping track of the X and Y scroll
offset as well as mechanisms for drawing scrollbars. See
scrollBy(int, int)
, scrollTo(int, int)
, and
awakenScrollBars()
for more details.
Unlike IDs, tags are not used to identify views. Tags are essentially an extra piece of information that can be associated with a view. They are most often used as a convenience to store data related to views in the views themselves rather than by putting them in a separate structure.
The View class exposes an ALPHA
property, as well as several transform-related
properties, such as TRANSLATION_X
and TRANSLATION_Y
. These properties are
available both in the Property
form as well as in similarly-named setter/getter
methods (such as setAlpha(float)
for ALPHA
). These properties can
be used to set persistent state associated with these rendering-related properties on the view.
The properties and methods can also be used in conjunction with
Animator
-based animations, described more in the
Animation section.
Starting with Android 3.0, the preferred way of animating views is to use the
android.animation
package APIs. These Animator
-based
classes change actual properties of the View object, such as alpha
and
translationX
. This behavior is contrasted to that of the pre-3.0
Animation
-based classes, which instead animate only
how the view is drawn on the display. In particular, the ViewPropertyAnimator
class
makes animating these View properties particularly easy and efficient.
Alternatively, you can use the pre-3.0 animation classes to animate how Views are rendered.
You can attach an Animation
object to a view using
setAnimation(Animation)
or
startAnimation(Animation)
. The animation can alter the scale,
rotation, translation and alpha of a view over time. If the animation is
attached to a view that has children, the animation will affect the entire
subtree rooted by that node. When an animation is started, the framework will
take care of redrawing the appropriate views until the animation completes.
Sometimes it is essential that an application be able to verify that an action is being performed with the full knowledge and consent of the user, such as granting a permission request, making a purchase or clicking on an advertisement. Unfortunately, a malicious application could try to spoof the user into performing these actions, unaware, by concealing the intended purpose of the view. As a remedy, the framework offers a touch filtering mechanism that can be used to improve the security of views that provide access to sensitive functionality.
To enable touch filtering, call setFilterTouchesWhenObscured(boolean)
or set the
android:filterTouchesWhenObscured layout attribute to true. When enabled, the framework
will discard touches that are received whenever the view's window is obscured by
another visible window. As a result, the view will not receive touches whenever a
toast, dialog or other window appears above the view's window.
For more fine-grained control over security, consider overriding the
onFilterTouchEventForSecurity(MotionEvent)
method to implement your own
security policy. See also FLAG_WINDOW_IS_OBSCURED
.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
View.AccessibilityDelegate |
This class represents a delegate that can be registered in a |
||||||||||
View.BaseSavedState |
Base class for derived classes that want to save and restore their own
state in onSaveInstanceState() .
|
||||||||||
View.DragShadowBuilder | Creates an image that the system displays during the drag and drop operation. | ||||||||||
View.MeasureSpec | A MeasureSpec encapsulates the layout requirements passed from parent to child. | ||||||||||
View.OnApplyWindowInsetsListener | Listener for applying window insets on a view in a custom way. | ||||||||||
View.OnAttachStateChangeListener | Interface definition for a callback to be invoked when this view is attached or detached from its window. | ||||||||||
View.OnClickListener | Interface definition for a callback to be invoked when a view is clicked. | ||||||||||
View.OnContextClickListener | Interface definition for a callback to be invoked when a view is context clicked. | ||||||||||
View.OnCreateContextMenuListener | Interface definition for a callback to be invoked when the context menu for this view is being built. | ||||||||||
View.OnDragListener | Interface definition for a callback to be invoked when a drag is being dispatched to this view. | ||||||||||
View.OnFocusChangeListener | Interface definition for a callback to be invoked when the focus state of a view changed. | ||||||||||
View.OnGenericMotionListener | Interface definition for a callback to be invoked when a generic motion event is dispatched to this view. | ||||||||||
View.OnHoverListener | Interface definition for a callback to be invoked when a hover event is dispatched to this view. | ||||||||||
View.OnKeyListener | Interface definition for a callback to be invoked when a hardware key event is dispatched to this view. | ||||||||||
View.OnLayoutChangeListener | Interface definition for a callback to be invoked when the layout bounds of a view changes due to layout processing. | ||||||||||
View.OnLongClickListener | Interface definition for a callback to be invoked when a view has been clicked and held. | ||||||||||
View.OnScrollChangeListener | Interface definition for a callback to be invoked when the scroll X or Y positions of a view change. | ||||||||||
View.OnSystemUiVisibilityChangeListener | Interface definition for a callback to be invoked when the status bar changes visibility. | ||||||||||
View.OnTouchListener | Interface definition for a callback to be invoked when a touch event is dispatched to this view. |
XML Attributes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
android:accessibilityLiveRegion | setAccessibilityLiveRegion(int) | Indicates to accessibility services whether the user should be notified when this view changes. | |||||||||
android:accessibilityTraversalAfter | setAccessibilityTraversalAfter(int) | Sets the id of a view after which this one is visited in accessibility traversal. | |||||||||
android:accessibilityTraversalBefore | setAccessibilityTraversalBefore(int) | Sets the id of a view before which this one is visited in accessibility traversal. | |||||||||
android:alpha | setAlpha(float) | alpha property of the view, as a value between 0 (completely transparent) and 1 (completely opaque). | |||||||||
android:background | setBackgroundResource(int) | A drawable to use as the background. | |||||||||
android:backgroundTint | setBackgroundTintList(ColorStateList) | Tint to apply to the background. | |||||||||
android:backgroundTintMode | setBackgroundTintMode(PorterDuff.Mode) | Blending mode used to apply the background tint. | |||||||||
android:clickable | setClickable(boolean) | Defines whether this view reacts to click events. | |||||||||
android:contentDescription | setContentDescription(CharSequence) | Defines text that briefly describes content of the view. | |||||||||
android:contextClickable | setContextClickable(boolean) | Defines whether this view reacts to context click events. | |||||||||
android:drawingCacheQuality | setDrawingCacheQuality(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:elevation | setElevation(float) |
base z depth of the view
Must be a dimension value, which is a floating point number appended with a unit such as " |
|||||||||
android:fadeScrollbars | setScrollbarFadingEnabled(boolean) | Defines whether to fade out scrollbars when they are not in use. | |||||||||
android:fadingEdgeLength | getVerticalFadingEdgeLength() | Defines the length of the fading edges. | |||||||||
android:filterTouchesWhenObscured | setFilterTouchesWhenObscured(boolean) | Specifies whether to filter touches when the view's window is obscured by another visible window. | |||||||||
android:fitsSystemWindows | setFitsSystemWindows(boolean) | Boolean internal attribute to adjust view layout based on system windows such as the status bar. | |||||||||
android:focusable | setFocusable(boolean) | Boolean that controls whether a view can take focus. | |||||||||
android:focusableInTouchMode | setFocusableInTouchMode(boolean) | Boolean that controls whether a view can take focus while in touch mode. | |||||||||
android:foreground | setForeground(Drawable) | Defines the drawable to draw over the content. | |||||||||
android:foregroundGravity | setForegroundGravity(int) | Defines the gravity to apply to the foreground drawable. | |||||||||
android:foregroundTint | setForegroundTintList(ColorStateList) | Tint to apply to the foreground. | |||||||||
android:foregroundTintMode | setForegroundTintMode(PorterDuff.Mode) | Blending mode used to apply the foreground tint. | |||||||||
android:hapticFeedbackEnabled | setHapticFeedbackEnabled(boolean) | Boolean that controls whether a view should have haptic feedback enabled for events such as long presses. | |||||||||
android:id | setId(int) |
Supply an identifier name for this view, to later retrieve it
with View.findViewById() or
Activity.findViewById() .
|
|||||||||
android:importantForAccessibility | setImportantForAccessibility(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:isScrollContainer | setScrollContainer(boolean) | Set this if the view will serve as a scrolling container, meaning that it can be resized to shrink its overall window so that there will be space for an input method. | |||||||||
android:keepScreenOn | setKeepScreenOn(boolean) | Controls whether the view's window should keep the screen on while visible. | |||||||||
android:layerType | setLayerType(int,Paint) | Specifies the type of layer backing this view. | |||||||||
android:layoutDirection | setLayoutDirection(int) | Defines the direction of layout drawing. | |||||||||
android:longClickable | setLongClickable(boolean) | Defines whether this view reacts to long click events. | |||||||||
android:minHeight | setMinimumHeight(int) | Defines the minimum height of the view. | |||||||||
android:minWidth | setMinimumWidth(int) | Defines the minimum width of the view. | |||||||||
android:nextFocusDown | setNextFocusDownId(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:nextFocusForward | setNextFocusForwardId(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:nextFocusLeft | setNextFocusLeftId(int) |
Defines the next view to give focus to when the next focus is
FOCUS_LEFT .
|
|||||||||
android:nextFocusRight | setNextFocusRightId(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:nextFocusUp | setNextFocusUpId(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:padding | setPaddingRelative(int,int,int,int) | Sets the padding, in pixels, of all four edges. | |||||||||
android:paddingBottom | setPaddingRelative(int,int,int,int) |
Sets the padding, in pixels, of the bottom edge; see padding .
|
|||||||||
android:paddingEnd | setPaddingRelative(int,int,int,int) |
Sets the padding, in pixels, of the end edge; see padding .
|
|||||||||
android:paddingLeft | setPadding(int,int,int,int) |
Sets the padding, in pixels, of the left edge; see padding .
|
|||||||||
android:paddingRight | setPadding(int,int,int,int) |
Sets the padding, in pixels, of the right edge; see padding .
|
|||||||||
android:paddingStart | setPaddingRelative(int,int,int,int) |
Sets the padding, in pixels, of the start edge; see padding .
|
|||||||||
android:paddingTop | setPaddingRelative(int,int,int,int) |
Sets the padding, in pixels, of the top edge; see padding .
|
|||||||||
android:requiresFadingEdge | setVerticalFadingEdgeEnabled(boolean) | Defines which edges should be faded on scrolling. | |||||||||
android:rotation | setRotation(float) | rotation of the view, in degrees. | |||||||||
android:rotationX | setRotationX(float) | rotation of the view around the x axis, in degrees. | |||||||||
android:rotationY | setRotationY(float) | rotation of the view around the y axis, in degrees. | |||||||||
android:saveEnabled | setSaveEnabled(boolean) | If false, no state will be saved for this view when it is being frozen. | |||||||||
android:scaleX | setScaleX(float) | scale of the view in the x direction. | |||||||||
android:scaleY | setScaleY(float) | scale of the view in the y direction. | |||||||||
android:scrollIndicators | setScrollIndicators(int) | Defines which scroll indicators should be displayed when the view can be scrolled. | |||||||||
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:scrollbarDefaultDelayBeforeFade | setScrollBarDefaultDelayBeforeFade(int) | Defines the delay in milliseconds that a scrollbar waits before fade out. | |||||||||
android:scrollbarFadeDuration | setScrollBarFadeDuration(int) | Defines the delay in milliseconds that a scrollbar takes to fade out. | |||||||||
android:scrollbarSize | setScrollBarSize(int) | Sets the width of vertical scrollbars and height of horizontal scrollbars. | |||||||||
android:scrollbarStyle | setScrollBarStyle(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:soundEffectsEnabled | setSoundEffectsEnabled(boolean) | Boolean that controls whether a view should have sound effects enabled for events such as clicking and touching. | |||||||||
android:stateListAnimator | Sets the state-based animator for the View. | ||||||||||
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:textAlignment | setTextAlignment(int) | Defines the alignment of the text. | |||||||||
android:textDirection | setTextDirection(int) | Defines the direction of the text. | |||||||||
android:transformPivotX | setPivotX(float) | x location of the pivot point around which the view will rotate and scale. | |||||||||
android:transformPivotY | setPivotY(float) | y location of the pivot point around which the view will rotate and scale. | |||||||||
android:transitionName | Names a View such that it can be identified for Transitions. | ||||||||||
android:translationX | setTranslationX(float) | translation in x of the view. | |||||||||
android:translationY | setTranslationY(float) | translation in y of the view. | |||||||||
android:translationZ | setTranslationZ(float) | translation in z of the view. | |||||||||
android:visibility | setVisibility(int) | Controls the initial visibility of the view. |
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | ACCESSIBILITY_LIVE_REGION_ASSERTIVE | Live region mode specifying that accessibility services should interrupt ongoing speech to immediately announce changes to this view. | |||||||||
int | ACCESSIBILITY_LIVE_REGION_NONE | Live region mode specifying that accessibility services should not automatically announce changes to this view. | |||||||||
int | ACCESSIBILITY_LIVE_REGION_POLITE | Live region mode specifying that accessibility services should announce changes to this view. | |||||||||
int | DRAWING_CACHE_QUALITY_AUTO |
Enables automatic quality mode for the drawing cache. |
|||||||||
int | DRAWING_CACHE_QUALITY_HIGH |
Enables high quality mode for the drawing cache. |
|||||||||
int | DRAWING_CACHE_QUALITY_LOW |
Enables low quality mode for the drawing cache. |
|||||||||
int | FIND_VIEWS_WITH_CONTENT_DESCRIPTION | Find find views that contain the specified content description. | |||||||||
int | FIND_VIEWS_WITH_TEXT | Find views that render the specified text. | |||||||||
int | FOCUSABLES_ALL |
View flag indicating whether addFocusables(ArrayList, int, int)
should add all focusable Views regardless if they are focusable in touch mode.
|
|||||||||
int | FOCUSABLES_TOUCH_MODE |
View flag indicating whether addFocusables(ArrayList, int, int)
should add only Views focusable in touch mode.
|
|||||||||
int | FOCUS_BACKWARD |
Use with focusSearch(int) .
|
|||||||||
int | FOCUS_DOWN |
Use with focusSearch(int) .
|
|||||||||
int | FOCUS_FORWARD |
Use with focusSearch(int) .
|
|||||||||
int | FOCUS_LEFT |
Use with focusSearch(int) .
|
|||||||||
int | FOCUS_RIGHT |
Use with focusSearch(int) .
|
|||||||||
int | FOCUS_UP |
Use with focusSearch(int) .
|
|||||||||
int | GONE | This view is invisible, and it doesn't take any space for layout purposes. | |||||||||
int | HAPTIC_FEEDBACK_ENABLED | View flag indicating whether this view should have haptic feedback enabled for events such as long presses. | |||||||||
int | IMPORTANT_FOR_ACCESSIBILITY_AUTO | Automatically determine whether a view is important for accessibility. | |||||||||
int | IMPORTANT_FOR_ACCESSIBILITY_NO | The view is not important for accessibility. | |||||||||
int | IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS | The view is not important for accessibility, nor are any of its descendant views. | |||||||||
int | IMPORTANT_FOR_ACCESSIBILITY_YES | The view is important for accessibility. | |||||||||
int | INVISIBLE | This view is invisible, but it still takes up space for layout purposes. | |||||||||
int | KEEP_SCREEN_ON | View flag indicating that the screen should remain on while the window containing this view is visible to the user. | |||||||||
int | LAYER_TYPE_HARDWARE |
Indicates that the view has a hardware layer. |
|||||||||
int | LAYER_TYPE_NONE | Indicates that the view does not have a layer. | |||||||||
int | LAYER_TYPE_SOFTWARE |
Indicates that the view has a software layer. |
|||||||||
int | LAYOUT_DIRECTION_INHERIT | Horizontal layout direction of this view is inherited from its parent. | |||||||||
int | LAYOUT_DIRECTION_LOCALE | Horizontal layout direction of this view is from deduced from the default language script for the locale. | |||||||||
int | LAYOUT_DIRECTION_LTR | Horizontal layout direction of this view is from Left to Right. | |||||||||
int | LAYOUT_DIRECTION_RTL | Horizontal layout direction of this view is from Right to Left. | |||||||||
int | MEASURED_HEIGHT_STATE_SHIFT |
Bit 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) .
|
|||||||||
int | MEASURED_SIZE_MASK |
Bits of getMeasuredWidthAndState() and
getMeasuredWidthAndState() that provide the actual measured size.
|
|||||||||
int | MEASURED_STATE_MASK |
Bits of getMeasuredWidthAndState() and
getMeasuredWidthAndState() that provide the additional state bits.
|
|||||||||
int | MEASURED_STATE_TOO_SMALL |
Bit of getMeasuredWidthAndState() and
getMeasuredWidthAndState() that indicates the measured size
is smaller that the space the view would like to have.
|
|||||||||
int | NO_ID | Used to mark a View that has no ID. | |||||||||
int | OVER_SCROLL_ALWAYS | Always allow a user to over-scroll this view, provided it is a view that can scroll. | |||||||||
int | OVER_SCROLL_IF_CONTENT_SCROLLS | Allow 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. | |||||||||
int | OVER_SCROLL_NEVER | Never allow a user to over-scroll this view. | |||||||||
int | SCREEN_STATE_OFF | Indicates that the screen has changed state and is now off. | |||||||||
int | SCREEN_STATE_ON | Indicates that the screen has changed state and is now on. | |||||||||
int | SCROLLBARS_INSIDE_INSET | The scrollbar style to display the scrollbars inside the padded area, increasing the padding of the view. | |||||||||
int | SCROLLBARS_INSIDE_OVERLAY | The scrollbar style to display the scrollbars inside the content area, without increasing the padding. | |||||||||
int | SCROLLBARS_OUTSIDE_INSET | The scrollbar style to display the scrollbars at the edge of the view, increasing the padding of the view. | |||||||||
int | SCROLLBARS_OUTSIDE_OVERLAY | The scrollbar style to display the scrollbars at the edge of the view, without increasing the padding. | |||||||||
int | SCROLLBAR_POSITION_DEFAULT | Position the scroll bar at the default position as determined by the system. | |||||||||
int | SCROLLBAR_POSITION_LEFT | Position the scroll bar along the left edge. | |||||||||
int | SCROLLBAR_POSITION_RIGHT | Position the scroll bar along the right edge. | |||||||||
int | SCROLL_AXIS_HORIZONTAL | Indicates scrolling along the horizontal axis. | |||||||||
int | SCROLL_AXIS_NONE | Indicates no axis of view scrolling. | |||||||||
int | SCROLL_AXIS_VERTICAL | Indicates scrolling along the vertical axis. | |||||||||
int | SCROLL_INDICATOR_BOTTOM | Scroll indicator direction for the bottom edge of the view. | |||||||||
int | SCROLL_INDICATOR_END | Scroll indicator direction for the ending edge of the view. | |||||||||
int | SCROLL_INDICATOR_LEFT | Scroll indicator direction for the left edge of the view. | |||||||||
int | SCROLL_INDICATOR_RIGHT | Scroll indicator direction for the right edge of the view. | |||||||||
int | SCROLL_INDICATOR_START | Scroll indicator direction for the starting edge of the view. | |||||||||
int | SCROLL_INDICATOR_TOP | Scroll indicator direction for the top edge of the view. | |||||||||
int | SOUND_EFFECTS_ENABLED | View flag indicating whether this view should have sound effects enabled for events such as clicking and touching. | |||||||||
int | STATUS_BAR_HIDDEN |
This constant was deprecated
in API level 14.
Use SYSTEM_UI_FLAG_LOW_PROFILE instead.
|
|||||||||
int | STATUS_BAR_VISIBLE |
This constant was deprecated
in API level 14.
Use SYSTEM_UI_FLAG_VISIBLE instead.
|
|||||||||
int | SYSTEM_UI_FLAG_FULLSCREEN |
Flag 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.
|
|||||||||
int | SYSTEM_UI_FLAG_HIDE_NAVIGATION |
Flag for setSystemUiVisibility(int) : View has requested that the
system navigation be temporarily hidden.
|
|||||||||
int | SYSTEM_UI_FLAG_IMMERSIVE |
Flag for setSystemUiVisibility(int) : View would like to remain interactive when
hiding the navigation bar with SYSTEM_UI_FLAG_HIDE_NAVIGATION .
|
|||||||||
int | SYSTEM_UI_FLAG_IMMERSIVE_STICKY |
Flag 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 .
|
|||||||||
int | SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
Flag for setSystemUiVisibility(int) : View would like its window
to be laid out as if it has requested
SYSTEM_UI_FLAG_FULLSCREEN , even if it currently hasn't.
|
|||||||||
int | SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
Flag for setSystemUiVisibility(int) : View would like its window
to be laid out as if it has requested
SYSTEM_UI_FLAG_HIDE_NAVIGATION , even if it currently hasn't.
|
|||||||||
int | SYSTEM_UI_FLAG_LAYOUT_STABLE |
Flag for setSystemUiVisibility(int) : When using other layout
flags, we would like a stable view of the content insets given to
fitSystemWindows(Rect) .
|
|||||||||
int | SYSTEM_UI_FLAG_LIGHT_STATUS_BAR |
Flag for setSystemUiVisibility(int) : Requests the status bar to draw in a mode that
is compatible with light status bar backgrounds.
|
|||||||||
int | SYSTEM_UI_FLAG_LOW_PROFILE |
Flag for setSystemUiVisibility(int) : View has requested the
system UI to enter an unobtrusive "low profile" mode.
|
|||||||||
int | SYSTEM_UI_FLAG_VISIBLE |
Special constant for setSystemUiVisibility(int) : View has
requested the system UI (status bar) to be visible (the default).
|
|||||||||
int | SYSTEM_UI_LAYOUT_FLAGS | Flags that can impact the layout in relation to system UI. | |||||||||
int | TEXT_ALIGNMENT_CENTER | Center the paragraph, e.g. | |||||||||
int | TEXT_ALIGNMENT_GRAVITY | Default for the root view. | |||||||||
int | TEXT_ALIGNMENT_INHERIT | Default text alignment. | |||||||||
int | TEXT_ALIGNMENT_TEXT_END | Align to the end of the paragraph, e.g. | |||||||||
int | TEXT_ALIGNMENT_TEXT_START | Align to the start of the paragraph, e.g. | |||||||||
int | TEXT_ALIGNMENT_VIEW_END | Align to the end of the view, which is ALIGN_RIGHT if the view’s resolved layoutDirection is LTR, and ALIGN_LEFT otherwise. | |||||||||
int | TEXT_ALIGNMENT_VIEW_START | Align to the start of the view, which is ALIGN_LEFT if the view’s resolved layoutDirection is LTR, and ALIGN_RIGHT otherwise. | |||||||||
int | TEXT_DIRECTION_ANY_RTL | Text direction is using "any-RTL" algorithm. | |||||||||
int | TEXT_DIRECTION_FIRST_STRONG | Text direction is using "first strong algorithm". | |||||||||
int | TEXT_DIRECTION_FIRST_STRONG_LTR | Text direction is using "first strong algorithm". | |||||||||
int | TEXT_DIRECTION_FIRST_STRONG_RTL | Text direction is using "first strong algorithm". | |||||||||
int | TEXT_DIRECTION_INHERIT |
Text direction is inherited through ViewGroup
|
|||||||||
int | TEXT_DIRECTION_LOCALE | Text direction is coming from the system Locale. | |||||||||
int | TEXT_DIRECTION_LTR | Text direction is forced to LTR. | |||||||||
int | TEXT_DIRECTION_RTL | Text direction is forced to RTL. | |||||||||
String | VIEW_LOG_TAG | The logging tag used by this class with android.util.Log. | |||||||||
int | VISIBLE | This view is visible. |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
ALPHA |
A Property wrapper around the alpha functionality handled by the
setAlpha(float) and getAlpha() methods.
|
||||||||||
EMPTY_STATE_SET | Indicates the view has no states set. | ||||||||||
ENABLED_FOCUSED_SELECTED_STATE_SET | Indicates the view is enabled, focused and selected. | ||||||||||
ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET | Indicates the view is enabled, focused, selected and its window has the focus. | ||||||||||
ENABLED_FOCUSED_STATE_SET | Indicates the view is enabled and has the focus. | ||||||||||
ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET | Indicates the view is enabled, focused and its window has the focus. | ||||||||||
ENABLED_SELECTED_STATE_SET | Indicates the view is enabled and selected. | ||||||||||
ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET | Indicates the view is enabled, selected and its window has the focus. | ||||||||||
ENABLED_STATE_SET | Indicates the view is enabled. | ||||||||||
ENABLED_WINDOW_FOCUSED_STATE_SET | Indicates the view is enabled and that its window has focus. | ||||||||||
FOCUSED_SELECTED_STATE_SET | Indicates the view is focused and selected. | ||||||||||
FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET | Indicates the view is focused, selected and its window has the focus. | ||||||||||
FOCUSED_STATE_SET | Indicates the view is focused. | ||||||||||
FOCUSED_WINDOW_FOCUSED_STATE_SET | Indicates the view has the focus and that its window has the focus. | ||||||||||
PRESSED_ENABLED_FOCUSED_SELECTED_STATE_SET | Indicates the view is pressed, enabled, focused and selected. | ||||||||||
PRESSED_ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET | Indicates the view is pressed, enabled, focused, selected and its window has the focus. | ||||||||||
PRESSED_ENABLED_FOCUSED_STATE_SET | Indicates the view is pressed, enabled and focused. | ||||||||||
PRESSED_ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET | Indicates the view is pressed, enabled, focused and its window has the focus. | ||||||||||
PRESSED_ENABLED_SELECTED_STATE_SET | Indicates the view is pressed, enabled and selected. | ||||||||||
PRESSED_ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET | Indicates the view is pressed, enabled, selected and its window has the focus. | ||||||||||
PRESSED_ENABLED_STATE_SET | Indicates the view is pressed and enabled. | ||||||||||
PRESSED_ENABLED_WINDOW_FOCUSED_STATE_SET | Indicates the view is pressed, enabled and its window has the focus. | ||||||||||
PRESSED_FOCUSED_SELECTED_STATE_SET | Indicates the view is pressed, focused and selected. | ||||||||||
PRESSED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET | Indicates the view is pressed, focused, selected and its window has the focus. | ||||||||||
PRESSED_FOCUSED_STATE_SET | Indicates the view is pressed and focused. | ||||||||||
PRESSED_FOCUSED_WINDOW_FOCUSED_STATE_SET | Indicates the view is pressed, focused and its window has the focus. | ||||||||||
PRESSED_SELECTED_STATE_SET | Indicates the view is pressed and selected. | ||||||||||
PRESSED_SELECTED_WINDOW_FOCUSED_STATE_SET | Indicates the view is pressed, selected and its window has the focus. | ||||||||||
PRESSED_STATE_SET | Indicates the view is pressed. | ||||||||||
PRESSED_WINDOW_FOCUSED_STATE_SET | Indicates the view is pressed and its window has the focus. | ||||||||||
ROTATION |
A Property wrapper around the rotation functionality handled by the
setRotation(float) and getRotation() methods.
|
||||||||||
ROTATION_X |
A Property wrapper around the rotationX functionality handled by the
setRotationX(float) and getRotationX() methods.
|
||||||||||
ROTATION_Y |
A Property wrapper around the rotationY functionality handled by the
setRotationY(float) and getRotationY() methods.
|
||||||||||
SCALE_X |
A Property wrapper around the scaleX functionality handled by the
setScaleX(float) and getScaleX() methods.
|
||||||||||
SCALE_Y |
A Property wrapper around the scaleY functionality handled by the
setScaleY(float) and getScaleY() methods.
|
||||||||||
SELECTED_STATE_SET | Indicates the view is selected. | ||||||||||
SELECTED_WINDOW_FOCUSED_STATE_SET | Indicates the view is selected and that its window has the focus. | ||||||||||
TRANSLATION_X |
A Property wrapper around the translationX functionality handled by the
setTranslationX(float) and getTranslationX() methods.
|
||||||||||
TRANSLATION_Y |
A Property wrapper around the translationY functionality handled by the
setTranslationY(float) and getTranslationY() methods.
|
||||||||||
TRANSLATION_Z |
A Property wrapper around the translationZ functionality handled by the
setTranslationZ(float) and getTranslationZ() methods.
|
||||||||||
WINDOW_FOCUSED_STATE_SET | Indicates the view's window has focus. | ||||||||||
X |
A Property wrapper around the x functionality handled by the
setX(float) and getX() methods.
|
||||||||||
Y |
A Property wrapper around the y functionality handled by the
setY(float) and getY() methods.
|
||||||||||
Z |
A Property wrapper around the z functionality handled by the
setZ(float) and getZ() methods.
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Simple constructor to use when creating a view from code.
| |||||||||||
Constructor that is called when inflating a view from XML.
| |||||||||||
Perform inflation from XML and apply a class-specific base style from a
theme attribute.
| |||||||||||
Perform inflation from XML and apply a class-specific base style from a
theme attribute or style resource.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Adds the children of this View relevant for accessibility to the given list
as output.
| |||||||||||
Adds any focusable views that are descendants of this view (possibly
including this view if it is focusable itself) to views.
| |||||||||||
Add any focusable views that are descendants of this view (possibly
including this view if it is focusable itself) to views.
| |||||||||||
Add a listener for attach state changes.
| |||||||||||
Add a listener that will be called when the bounds of the view change due to
layout processing.
| |||||||||||
Add any touchable views that are descendants of this view (possibly
including this view if it is touchable itself) to views.
| |||||||||||
This method returns a ViewPropertyAnimator object, which can be used to animate
specific properties on this View.
| |||||||||||
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.
| |||||||||||
Change the view's z order in the tree, so it's on top of other sibling
views.
| |||||||||||
Calling this method is equivalent to calling | |||||||||||
Forces the drawing cache to be built if the drawing cache is invalid. | |||||||||||
Forces this view's layer to be created and this view to be rendered
into its layer.
| |||||||||||
Directly call any attached OnClickListener.
| |||||||||||
Check if layout direction resolution can be done.
| |||||||||||
Check if text alignment resolution can be done.
| |||||||||||
Check if text direction resolution can be done.
| |||||||||||
Check if this view can be scrolled horizontally in a certain direction.
| |||||||||||
Check if this view can be scrolled vertically in a certain direction.
| |||||||||||
Cancels a pending long press.
| |||||||||||
Cancel any deferred high-level input events that were previously posted to the event queue.
| |||||||||||
Called by the
InputMethodManager
when a view who is not the current
input connection target is trying to make a call on the manager.
| |||||||||||
Cancels any animations for this view.
| |||||||||||
Called when this view wants to give up focus.
| |||||||||||
Merge two states as returned by
getMeasuredState() .
| |||||||||||
Called by a parent to request that a child update its values for mScrollX
and mScrollY if necessary.
| |||||||||||
Compute insets that should be consumed by this view and the ones that should propagate
to those under it.
| |||||||||||
Returns an
AccessibilityNodeInfo representing this view from the
point of view of an AccessibilityService .
| |||||||||||
Show the context menu for this view.
| |||||||||||
Frees the resources used by the drawing cache. | |||||||||||
Request to apply the given window insets to this view or another view in its subtree.
| |||||||||||
Dispatch a notification about a resource configuration change down
the view hierarchy.
| |||||||||||
Dispatch a hint about whether this view is displayed.
| |||||||||||
Detects if this View is enabled and has a drag event listener.
| |||||||||||
Dispatches drawableHotspotChanged to all of this View's children.
| |||||||||||
Dispatch a generic motion event.
| |||||||||||
Dispatch a key event to the next view on the focus path.
| |||||||||||
Dispatch a key event before it is processed by any input method
associated with the view hierarchy.
| |||||||||||
Dispatches a key shortcut event.
| |||||||||||
Dispatch a fling to a nested scrolling parent.
| |||||||||||
Dispatch a fling to a nested scrolling parent before it is processed by this view.
| |||||||||||
Report an accessibility action to this view's parents for delegated processing.
| |||||||||||
Dispatch one step of a nested scroll in progress before this view consumes any portion of it.
| |||||||||||
Dispatch one step of a nested scroll in progress.
| |||||||||||
Dispatches an
AccessibilityEvent to the View first and then
to its children for adding their text content to the event.
| |||||||||||
Dispatch creation of
ViewStructure down the hierarchy.
| |||||||||||
Dispatch callbacks to
setOnSystemUiVisibilityChangeListener(View.OnSystemUiVisibilityChangeListener) down
the view hierarchy.
| |||||||||||
Pass the touch screen motion event down to the target view, or this
view if it is the target.
| |||||||||||
Pass a trackball motion event down to the focused view.
| |||||||||||
This method is the last chance for the focused view and its ancestors to
respond to an arrow key.
| |||||||||||
Called when the window containing this view gains or loses window focus.
| |||||||||||
Dispatch callbacks to
onWindowSystemUiVisibilityChanged(int) down
the view hierarchy.
| |||||||||||
Dispatch a window visibility change down the view hierarchy.
| |||||||||||
Manually render this view (and all of its children) to the given Canvas.
| |||||||||||
This function is called whenever the view hotspot changes and needs to
be propagated to drawables or child views managed by the view.
| |||||||||||
Find the view in the hierarchy rooted at this view that currently has
focus.
| |||||||||||
Look for a child view with the given id.
| |||||||||||
Look for a child view with the given tag.
| |||||||||||
Finds the Views that contain given text.
| |||||||||||
Find the nearest view in the specified direction that can take focus.
| |||||||||||
Forces this view to be laid out during the next layout pass.
| |||||||||||
Generate a value suitable for use in
setId(int) .
| |||||||||||
Return the class name of this object to be used for accessibility purposes.
| |||||||||||
Gets the live region mode for this View.
| |||||||||||
Gets the provider for managing a virtual view hierarchy rooted at this View
and reported to
AccessibilityService s
that explore the window content.
| |||||||||||
Gets the id of a view after which this one is visited in accessibility traversal.
| |||||||||||
Gets the id of a view before which this one is visited in accessibility traversal.
| |||||||||||
The opacity of the view.
| |||||||||||
Get the animation currently associated with this view.
| |||||||||||
Retrieve a unique token identifying the top-level "real" window of
the window that this view is attached to.
| |||||||||||
Gets the background drawable
| |||||||||||
Return the tint applied to the background drawable, if specified.
| |||||||||||
Return the blending mode used to apply the tint to the background
drawable, if specified.
| |||||||||||
Return the offset of the widget's text baseline from the widget's top boundary. | |||||||||||
Bottom position of this view relative to its parent.
| |||||||||||
Gets the distance along the Z axis from the camera to this view.
| |||||||||||
Returns a copy of the current
clipBounds .
| |||||||||||
Populates an output rectangle with the clip bounds of the view,
returning
true if successful or false if the view's
clip bounds are null .
| |||||||||||
Returns whether the Outline should be used to clip the contents of the View.
| |||||||||||
Gets the
View description.
| |||||||||||
Returns the context the view is running in, through which it can
access the current theme, resources, etc.
| |||||||||||
Utility to return a default size.
| |||||||||||
Gets the logical display to which the view's window has been attached.
| |||||||||||
Return an array of resource IDs of the drawable states representing the
current state of the view.
| |||||||||||
Returns the bitmap in which this view drawing is cached. | |||||||||||
Calling this method is equivalent to calling | |||||||||||
Returns the quality of the drawing cache.
| |||||||||||
Return the visible drawing bounds of your view.
| |||||||||||
Return the time at which the drawing of the view hierarchy started. | |||||||||||
The base elevation of this view relative to its parent, in pixels.
| |||||||||||
Gets whether the framework should discard touches when the view's
window is obscured by another visible window.
| |||||||||||
Check for state of
setFitsSystemWindows(boolean) .
| |||||||||||
Find and return all focusable views that are descendants of this view,
possibly including this view if it is focusable itself.
| |||||||||||
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.
| |||||||||||
Returns the drawable used as the foreground of this View.
| |||||||||||
Describes how the foreground is positioned.
| |||||||||||
Return the tint applied to the foreground drawable, if specified.
| |||||||||||
Return the blending mode used to apply the tint to the foreground
drawable, if specified.
| |||||||||||
If some part of this view is not clipped by any of its parents, then
return that area in r in global (root) coordinates.
| |||||||||||
Return the height of your view.
| |||||||||||
Hit rectangle in parent's coordinates
| |||||||||||
Returns the size of the horizontal faded edges used to indicate that more
content in this view is visible.
| |||||||||||
Returns this view's identifier.
| |||||||||||
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.
| |||||||||||
Returns whether the screen should remain on, corresponding to the current
value of
KEEP_SCREEN_ON .
| |||||||||||
Return the global
KeyEvent.DispatcherState
for this view's window.
| |||||||||||
Gets the id of a view for which this view serves as a label for
accessibility purposes.
| |||||||||||
Indicates what type of layer is currently associated with this view.
| |||||||||||
Returns the resolved layout direction for this view.
| |||||||||||
Get the LayoutParams associated with this view.
| |||||||||||
Left position of this view relative to its parent.
| |||||||||||
Computes the coordinates of this view in its window. | |||||||||||
Computes the coordinates of this view on the screen. | |||||||||||
The transform matrix of this view, which is calculated based on the current
rotation, scale, and pivot properties.
| |||||||||||
Like
getMeasuredHeightAndState() , but only returns the
raw width component (that is the result is masked by
MEASURED_SIZE_MASK ).
| |||||||||||
Return the full height measurement information for this view as computed
by the most recent call to
measure(int, int) .
| |||||||||||
Return only the state bits of
getMeasuredWidthAndState()
and getMeasuredHeightAndState() , combined into one integer.
| |||||||||||
Like
getMeasuredWidthAndState() , but only returns the
raw width component (that is the result is masked by
MEASURED_SIZE_MASK ).
| |||||||||||
Return the full width measurement information for this view as computed
by the most recent call to
measure(int, int) .
| |||||||||||
Returns the minimum height of the view.
| |||||||||||
Returns the minimum width of the view.
| |||||||||||
Gets the id of the view to use when the next focus is
FOCUS_DOWN .
| |||||||||||
Gets the id of the view to use when the next focus is
FOCUS_FORWARD .
| |||||||||||
Gets the id of the view to use when the next focus is
FOCUS_LEFT .
| |||||||||||
Gets the id of the view to use when the next focus is
FOCUS_RIGHT .
| |||||||||||
Gets the id of the view to use when the next focus is
FOCUS_UP .
| |||||||||||
Returns the focus-change callback registered for this view.
| |||||||||||
Returns the current
ViewOutlineProvider of the view, which generates the Outline
that defines the shape of the shadow it casts, and enables outline clipping.
| |||||||||||
Returns the over-scroll mode for this view.
| |||||||||||
Returns the overlay for this view, creating it if it does not yet exist.
| |||||||||||
Returns the bottom padding of this view.
| |||||||||||
Returns the end padding of this view depending on its resolved layout direction.
| |||||||||||
Returns the left padding of this view.
| |||||||||||
Returns the right padding of this view.
| |||||||||||
Returns the start padding of this view depending on its resolved layout direction.
| |||||||||||
Returns the top padding of this view.
| |||||||||||
Gets the parent of this view.
| |||||||||||
Gets the parent for accessibility purposes.
| |||||||||||
Returns the resources associated with this view.
| |||||||||||
Right position of this view relative to its parent.
| |||||||||||
Finds the topmost view in the current view hierarchy. | |||||||||||
Provide original WindowInsets that are dispatched to the view hierarchy.
| |||||||||||
The degrees that the view is rotated around the pivot point.
| |||||||||||
The degrees that the view is rotated around the horizontal axis through the pivot point.
| |||||||||||
The degrees that the view is rotated around the vertical axis through the pivot point.
| |||||||||||
The amount that the view is scaled in x around the pivot point, as a proportion of
the view's unscaled width.
| |||||||||||
The amount that the view is scaled in y around the pivot point, as a proportion of
the view's unscaled height.
| |||||||||||
Returns the delay before scrollbars fade.
| |||||||||||
Returns the scrollbar fade duration.
| |||||||||||
Returns the scrollbar size.
| |||||||||||
Returns the current scrollbar style. | |||||||||||
Returns a bitmask representing the enabled scroll indicators.
| |||||||||||
Return the scrolled left position of this view.
| |||||||||||
Return the scrolled top position of this view.
| |||||||||||
Override this if your view is known to always be drawn on top of a solid color background,
and needs to draw fading edges.
| |||||||||||
Returns the current StateListAnimator if exists.
| |||||||||||
Returns the last
setSystemUiVisibility(int) that this view has requested.
| |||||||||||
Returns the tag associated with this view and the specified key.
| |||||||||||
Returns this view's tag.
| |||||||||||
Return the resolved text alignment.
| |||||||||||
Return the resolved text direction.
| |||||||||||
Top position of this view relative to its parent.
| |||||||||||
Gets the TouchDelegate for this View.
| |||||||||||
Find and return all touchable views that are descendants of this view,
possibly including this view if it is touchable itself.
| |||||||||||
Returns the name of the View to be used to identify Views in Transitions.
| |||||||||||
The horizontal location of this view relative to its
left position.
| |||||||||||
The vertical location of this view relative to its
top position.
| |||||||||||
The depth location of this view relative to its
elevation .
| |||||||||||
Returns the size of the vertical faded edges used to indicate that more
content in this view is visible.
| |||||||||||
Returns the width of the vertical scrollbar.
| |||||||||||
Returns the ViewTreeObserver for this view's hierarchy.
| |||||||||||
Returns the visibility status for this view.
| |||||||||||
Return the width of the your view.
| |||||||||||
Retrieve the
WindowId for the window this view is
currently attached to.
| |||||||||||
Returns the current system UI visibility that is currently set for
the entire window.
| |||||||||||
Retrieve a unique token identifying the window this view is attached to.
| |||||||||||
Retrieve the overall visible display size in which the window this view is
attached to has been positioned in.
| |||||||||||
The visual x position of this view, in pixels.
| |||||||||||
The visual y position of this view, in pixels.
| |||||||||||
The visual z position of this view, in pixels.
| |||||||||||
Returns true if this view has focus itself, or is the ancestor of the
view that has focus.
| |||||||||||
Returns true if this view is focusable or if it contains a reachable View
for which
hasFocusable() returns true.
| |||||||||||
Returns true if this view has a nested scrolling parent.
| |||||||||||
Return whether this view has an attached OnClickListener.
| |||||||||||
Returns whether this View has content which overlaps.
| |||||||||||
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.
| |||||||||||
Returns true if this view is in a window that currently has window focus.
| |||||||||||
Inflate a view from an XML resource.
| |||||||||||
Mark the area defined by dirty as needing to be drawn.
| |||||||||||
Mark the area defined by the rect (l,t,r,b) as needing to be drawn.
| |||||||||||
Invalidate the whole view.
| |||||||||||
Invalidates the specified Drawable.
| |||||||||||
Called to rebuild this View's Outline from its
outline provider
| |||||||||||
Returns whether this View is accessibility focused.
| |||||||||||
Indicates the activation state of this view.
| |||||||||||
Returns true if this view is currently attached to a window.
| |||||||||||
Indicates whether this view reacts to click events or not.
| |||||||||||
Indicates whether this view reacts to context clicks or not.
| |||||||||||
True if this view has changed since the last time being drawn.
| |||||||||||
Indicates whether the drawing cache is enabled for this view. | |||||||||||
Indicates whether this duplicates its drawable state from its parent. | |||||||||||
Returns the enabled status for this view.
| |||||||||||
Returns whether this View is able to take focus.
| |||||||||||
When a view is focusable, it may not want to take focus when in touch mode.
| |||||||||||
Returns true if this view has focus
| |||||||||||
Indicates whether this view is attached to a hardware accelerated window or not. | |||||||||||
Indicate whether the horizontal edges are faded when the view is scrolled horizontally. | |||||||||||
Indicate whether the horizontal scrollbar should be drawn or not. | |||||||||||
Returns true if the view is currently hovered.
| |||||||||||
Computes whether this view should be exposed for accessibility.
| |||||||||||
Indicates whether this View is currently in edit mode.
| |||||||||||
Returns whether the view hierarchy is currently undergoing a layout pass.
| |||||||||||
Returns whether the device is currently in touch mode.
| |||||||||||
Returns true if this view has been through at least one layout since it
was last attached to or detached from a window.
| |||||||||||
Indicates whether or not this view's layout will be requested during the next hierarchy layout pass. | |||||||||||
Indicates whether this view reacts to long click events or not.
| |||||||||||
Returns true if nested scrolling is enabled for this view.
| |||||||||||
Indicates whether this View is opaque.
| |||||||||||
Return if the padding has been set through relative values
setPaddingRelative(int, int, int, int) or through
| |||||||||||
Indicates whether the view is currently in pressed state.
| |||||||||||
Indicates whether this view will save its state (that is,
whether its
onSaveInstanceState() method will be called).
| |||||||||||
Indicates whether the entire hierarchy under this view will save its
state when a state saving traversal occurs from its parent.
| |||||||||||
Indicates whether this view is one of the set of scrollable containers in
its window.
| |||||||||||
Returns true if scrollbars will fade when this view is not scrolling
| |||||||||||
Indicates the selection state of this view.
| |||||||||||
Returns the visibility of this view and all of its ancestors
| |||||||||||
Indicate whether the vertical edges are faded when the view is scrolled horizontally. | |||||||||||
Indicate whether the vertical scrollbar should be drawn or not. | |||||||||||
Call
Drawable.jumpToCurrentState()
on all Drawable objects associated with this view.
| |||||||||||
Assign a size and position to a view and all of its
descendants
This is the second phase of the layout mechanism. | |||||||||||
This is called to find out how big a view should be. | |||||||||||
Offset this view's horizontal location by the specified amount of pixels.
| |||||||||||
Offset this view's vertical location by the specified number of pixels.
| |||||||||||
Called when the view should apply
WindowInsets according to its internal policy.
| |||||||||||
Called as the result of a call to
cancelPendingInputEvents() on this view or
a parent view.
| |||||||||||
Check whether the called view is a text editor, in which case it
would make sense to automatically display a soft input window for
it.
| |||||||||||
Create a new InputConnection for an InputMethod to interact
with the view.
| |||||||||||
Handles drag events sent by the system following a call to
startDrag() .
| |||||||||||
Draw any foreground content for this view.
| |||||||||||
Filter the touch event to apply security policies.
| |||||||||||
Called after
onStartTemporaryDetach() when the container is done
changing the view.
| |||||||||||
Implement this method to handle generic motion events.
| |||||||||||
Implement this method to handle hover state changes.
| |||||||||||
Implement this method to handle hover events.
| |||||||||||
Initializes an
AccessibilityEvent with information about
this View which is the event source.
| |||||||||||
Initializes an
AccessibilityNodeInfo with information about this view.
| |||||||||||
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.
| |||||||||||
Default implementation of
KeyEvent.Callback.onKeyLongPress() : always returns false (doesn't handle
the event).
| |||||||||||
Default implementation of
KeyEvent.Callback.onKeyMultiple() : always returns false (doesn't handle
the event).
| |||||||||||
Handle a key event before it is processed by any input method
associated with the view hierarchy.
| |||||||||||
Called on the focused view when a key shortcut event is not handled.
| |||||||||||
Default implementation of
KeyEvent.Callback.onKeyUp() : perform clicking of the view
when KEYCODE_DPAD_CENTER or
KEYCODE_ENTER is released.
| |||||||||||
Called from
dispatchPopulateAccessibilityEvent(AccessibilityEvent)
giving a chance to this View to populate the accessibility event with its
text content.
| |||||||||||
Called when assist structure is being retrieved from a view as part of
Activity.onProvideAssistData .
| |||||||||||
Called when assist structure is being retrieved from a view as part of
Activity.onProvideAssistData to
generate additional virtual structure under this view.
| |||||||||||
Called when any RTL property (layout direction or text direction or text alignment) has
been changed.
| |||||||||||
This method is called whenever the state of the screen this view is
attached to changes.
| |||||||||||
This is called when a container is going to temporarily detach a child, with
ViewGroup.detachViewFromParent .
| |||||||||||
Implement this method to handle touch screen motion events.
| |||||||||||
Implement this method to handle trackball motion events.
| |||||||||||
Called when the window containing this view gains or loses focus.
| |||||||||||
Override to find out when the window's requested system UI visibility
has changed, that is the value returned by
getWindowSystemUiVisibility() .
| |||||||||||
Performs the specified accessibility action on the view.
| |||||||||||
Call this view's OnClickListener, if it is defined.
| |||||||||||
Call this view's OnContextClickListener, if it is defined.
| |||||||||||
BZZZTT!!1!
Provide haptic feedback to the user for this view. | |||||||||||
BZZZTT!!1!
Like | |||||||||||
Call this view's OnLongClickListener, if it is defined.
| |||||||||||
Play a sound effect for this view.
| |||||||||||
Causes the Runnable to be added to the message queue. | |||||||||||
Causes the Runnable to be added to the message queue, to be run after the specified amount of time elapses. | |||||||||||
Cause an invalidate of the specified area to happen on a subsequent cycle through the event loop. | |||||||||||
Cause an invalidate to happen on a subsequent cycle through the event loop. | |||||||||||
Cause an invalidate of the specified area to happen on a subsequent cycle through the event loop. | |||||||||||
Cause an invalidate to happen on a subsequent cycle through the event loop. | |||||||||||
Cause an invalidate of the specified area to happen on the next animation time step, typically the next display frame. | |||||||||||
Cause an invalidate to happen on the next animation time step, typically the next display frame. | |||||||||||
Causes the Runnable to execute on the next animation time step. | |||||||||||
Causes the Runnable to execute on the next animation time step, after the specified amount of time elapses. | |||||||||||
Call this to force a view to update its drawable state.
| |||||||||||
Removes the specified Runnable from the message queue. | |||||||||||
Remove a listener for attach state changes.
| |||||||||||
Remove a listener for layout changes.
| |||||||||||
Ask that a new dispatch of
onApplyWindowInsets(WindowInsets) be performed.
| |||||||||||
This method was deprecated
in API level 20.
Use
requestApplyInsets() for newer platform versions.
| |||||||||||
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.
| |||||||||||
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.
| |||||||||||
Call this to try to give focus to a specific view or to one of its
descendants.
| |||||||||||
Call this to try to give focus to a specific view or to one of its descendants.
| |||||||||||
Call this when something has changed which has invalidated the
layout of this view.
| |||||||||||
Request that a rectangle of this view be visible on the screen,
scrolling if necessary just enough.
| |||||||||||
Request that a rectangle of this view be visible on the screen,
scrolling if necessary just enough.
| |||||||||||
Request unbuffered dispatch of the given stream of MotionEvents to this View.
| |||||||||||
Version of
resolveSizeAndState(int, int, int)
returning only the MEASURED_SIZE_MASK bits of the result.
| |||||||||||
Utility to reconcile a desired size and state, with constraints imposed
by a MeasureSpec.
| |||||||||||
Restore this view hierarchy's frozen state from the given container.
| |||||||||||
Store this view hierarchy's frozen state into the given container.
| |||||||||||
Schedules an action on a drawable to occur at a specified time.
| |||||||||||
Move the scrolled position of your view.
| |||||||||||
Set the scrolled position of your view.
| |||||||||||
Sends an accessibility event of the given type.
| |||||||||||
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.
| |||||||||||
Sets a delegate for implementing accessibility support via composition as
opposed to inheritance.
| |||||||||||
Sets the live region mode for this view.
| |||||||||||
Sets the id of a view after which this one is visited in accessibility traversal.
| |||||||||||
Sets the id of a view before which this one is visited in accessibility traversal.
| |||||||||||
Changes the activated state of this view.
| |||||||||||
Sets the opacity of the view to a value from 0 to 1, where 0 means the view is
completely transparent and 1 means the view is completely opaque.
| |||||||||||
Sets the next animation to play for this view.
| |||||||||||
Set the background to a given Drawable, or remove the background.
| |||||||||||
Sets the background color for this view.
| |||||||||||
This method was deprecated
in API level 16.
use
setBackground(Drawable) instead
| |||||||||||
Set the background to a given resource.
| |||||||||||
Applies a tint to the background drawable.
| |||||||||||
Specifies the blending mode used to apply the tint specified by
setBackgroundTintList(ColorStateList) } to the background
drawable.
| |||||||||||
Sets the bottom position of this view relative to its parent.
| |||||||||||
Sets the distance along the Z axis (orthogonal to the X/Y plane on which views are drawn) from the camera to this view. | |||||||||||
Enables or disables click events for this view.
| |||||||||||
Sets a rectangular area on this view to which the view will be clipped
when it is drawn.
| |||||||||||
Sets whether the View's Outline should be used to clip the contents of the View.
| |||||||||||
Sets the
View description.
| |||||||||||
Enables or disables context clicking for this view.
| |||||||||||
Setting a solid background color for the drawing cache's bitmaps will improve
performance and memory usage.
| |||||||||||
Enables or disables the drawing cache. | |||||||||||
Set the drawing cache quality of this view.
| |||||||||||
Enables or disables the duplication of the parent's state into this view. | |||||||||||
Sets the base elevation of this view, in pixels.
| |||||||||||
Set the enabled state of this view.
| |||||||||||
Set the size of the faded edge used to indicate that more content in this
view is available.
| |||||||||||
Sets whether the framework should discard touches when the view's
window is obscured by another visible window.
| |||||||||||
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.
| |||||||||||
Set whether this view can receive the focus.
| |||||||||||
Set whether this view can receive focus while in touch mode.
| |||||||||||
Supply a Drawable that is to be rendered on top of all of the content in the view.
| |||||||||||
Describes how the foreground is positioned.
| |||||||||||
Applies a tint to the foreground drawable.
| |||||||||||
Specifies the blending mode used to apply the tint specified by
setForegroundTintList(ColorStateList) } to the background
drawable.
| |||||||||||
Set whether this view should have haptic feedback for events such as
long presses.
| |||||||||||
Set whether this view is currently tracking transient state that the
framework should attempt to preserve when possible.
| |||||||||||
Define whether the horizontal edges should be faded when this view is scrolled horizontally. | |||||||||||
Define whether the horizontal scrollbar should be drawn or not. | |||||||||||
Sets whether the view is currently hovered.
| |||||||||||
Sets the identifier for this view.
| |||||||||||
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.
| |||||||||||
Controls whether the screen should remain on, modifying the
value of
KEEP_SCREEN_ON .
| |||||||||||
Sets the id of a view for which this view serves as a label for
accessibility purposes.
| |||||||||||
Updates the
Paint object used with the current layer (used only if the current
layer type is not set to LAYER_TYPE_NONE ).
| |||||||||||
Specifies the type of layer backing this view. | |||||||||||
Set the layout direction for this view.
| |||||||||||
Set the layout parameters associated with this view.
| |||||||||||
Sets the left position of this view relative to its parent.
| |||||||||||
Enables or disables long click events for this view.
| |||||||||||
Sets the minimum height of the view.
| |||||||||||
Sets the minimum width of the view.
| |||||||||||
Enable or disable nested scrolling for this view.
| |||||||||||
Sets the id of the view to use when the next focus is
FOCUS_DOWN .
| |||||||||||
Sets the id of the view to use when the next focus is
FOCUS_FORWARD .
| |||||||||||
Sets the id of the view to use when the next focus is
FOCUS_LEFT .
| |||||||||||
Sets the id of the view to use when the next focus is
FOCUS_RIGHT .
| |||||||||||
Sets the id of the view to use when the next focus is
FOCUS_UP .
| |||||||||||
Set an
View.OnApplyWindowInsetsListener to take over the policy for applying
window insets to this view.
| |||||||||||
Register a callback to be invoked when this view is clicked.
| |||||||||||
Register a callback to be invoked when this view is context clicked.
| |||||||||||
Register a callback to be invoked when the context menu for this view is
being built.
| |||||||||||
Register a drag event listener callback object for this View.
| |||||||||||
Register a callback to be invoked when focus of this view changed.
| |||||||||||
Register a callback to be invoked when a generic motion event is sent to this view.
| |||||||||||
Register a callback to be invoked when a hover event is sent to this view.
| |||||||||||
Register a callback to be invoked when a hardware key is pressed in this view.
| |||||||||||
Register a callback to be invoked when this view is clicked and held.
| |||||||||||
Register a callback to be invoked when the scroll X or Y positions of
this view change.
| |||||||||||
Set a listener to receive callbacks when the visibility of the system bar changes.
| |||||||||||
Register a callback to be invoked when a touch event is sent to this view.
| |||||||||||
Sets the
ViewOutlineProvider of the view, which generates the Outline that defines
the shape of the shadow it casts, and enables outline clipping.
| |||||||||||
Set the over-scroll mode for this view.
| |||||||||||
Sets the padding.
| |||||||||||
Sets the relative padding.
| |||||||||||
Sets the pressed state for this view.
| |||||||||||
Sets the right position of this view relative to its parent.
| |||||||||||
Sets the degrees that the view is rotated around the pivot point.
| |||||||||||
Sets the degrees that the view is rotated around the horizontal axis through the pivot point.
| |||||||||||
Sets the degrees that the view is rotated around the vertical axis through the pivot point.
| |||||||||||
Controls whether the saving of this view's state is
enabled (that is, whether its
onSaveInstanceState() method
will be called).
| |||||||||||
Controls whether the entire hierarchy under this view will save its
state when a state saving traversal occurs from its parent.
| |||||||||||
Sets the amount that the view is scaled in x around the pivot point, as a proportion of
the view's unscaled width.
| |||||||||||
Sets the amount that the view is scaled in Y around the pivot point, as a proportion of
the view's unscaled width.
| |||||||||||
Define the delay before scrollbars fade.
| |||||||||||
Define the scrollbar fade duration.
| |||||||||||
Define the scrollbar size.
| |||||||||||
Specify the style of the scrollbars. | |||||||||||
Change whether this view is one of the set of scrollable containers in
its window.
| |||||||||||
Sets the state of the scroll indicators specified by the mask.
| |||||||||||
Sets the state of all scroll indicators.
| |||||||||||
Set the horizontal scrolled position of your view.
| |||||||||||
Set the vertical scrolled position of your view.
| |||||||||||
Define whether scrollbars will fade when the view is not scrolling.
| |||||||||||
Changes the selection state of this view.
| |||||||||||
Set whether this view should have sound effects enabled for events such as
clicking and touching.
| |||||||||||
Attaches the provided StateListAnimator to this View.
| |||||||||||
Request that the visibility of the status bar or other screen/window
decorations be changed.
| |||||||||||
Sets a tag associated with this view and a key.
| |||||||||||
Sets the tag associated with this view.
| |||||||||||
Set the text alignment.
| |||||||||||
Set the text direction.
| |||||||||||
Sets the top position of this view relative to its parent.
| |||||||||||
Sets the TouchDelegate for this View.
| |||||||||||
Sets the name of the View to be used to identify Views in Transitions.
| |||||||||||
Sets the horizontal location of this view relative to its
left position.
| |||||||||||
Sets the vertical location of this view relative to its
top position.
| |||||||||||
Sets the depth location of this view relative to its
elevation .
| |||||||||||
Define whether the vertical edges should be faded when this view is scrolled vertically. | |||||||||||
Define whether the vertical scrollbar should be drawn or not. | |||||||||||
Set the position of the vertical scroll bar.
| |||||||||||
Set the enabled state of this view.
| |||||||||||
When a View's drawing cache is enabled, drawing is redirected to an
offscreen bitmap.
| |||||||||||
If this view doesn't do any drawing on its own, set this flag to
allow further optimizations.
| |||||||||||
Sets the visual x position of this view, in pixels.
| |||||||||||
Sets the visual y position of this view, in pixels.
| |||||||||||
Sets the visual z position of this view, in pixels.
| |||||||||||
Bring up the context menu for this view.
| |||||||||||
Start an action mode with the given type.
| |||||||||||
Start an action mode with the default type
TYPE_PRIMARY .
| |||||||||||
Start the specified animation now.
| |||||||||||
Starts a drag and drop operation.
| |||||||||||
Begin a nestable scroll operation along the given axes.
| |||||||||||
Stop a nested scroll in progress.
| |||||||||||
Returns a string containing a concise, human-readable description of this
object.
| |||||||||||
Unschedule any events associated with the given Drawable.
| |||||||||||
Cancels a scheduled action on a drawable.
| |||||||||||
Returns whether or not this View can cache its drawing or not.
| |||||||||||
Returns whether or not this View draws on its own.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Trigger the scrollbars to draw. | |||||||||||
Trigger the scrollbars to draw. | |||||||||||
Trigger the scrollbars to draw. | |||||||||||
Compute the horizontal extent of the horizontal scrollbar's thumb within the horizontal range. | |||||||||||
Compute the horizontal offset of the horizontal scrollbar's thumb within the horizontal range. | |||||||||||
Compute the horizontal range that the horizontal scrollbar represents. | |||||||||||
Compute the vertical extent of the vertical scrollbar's thumb within the vertical range. | |||||||||||
Compute the vertical offset of the vertical scrollbar's thumb within the horizontal range. | |||||||||||
Compute the vertical range that the vertical scrollbar represents. | |||||||||||
Called by draw to draw the child views.
| |||||||||||
Dispatch a generic motion event to the currently focused view.
| |||||||||||
Dispatch a generic motion event to the view under the first pointer.
| |||||||||||
Dispatch a hover event.
| |||||||||||
Called by
restoreHierarchyState(android.util.SparseArray) to retrieve the
state for this view and its children.
| |||||||||||
Called by
saveHierarchyState(android.util.SparseArray) to store the state for
this view and its children.
| |||||||||||
Dispatch setActivated to all of this View's children.
| |||||||||||
Dispatch setPressed to all of this View's children.
| |||||||||||
Dispatch setSelected to all of this View's children.
| |||||||||||
Dispatch a view visibility change down the view hierarchy.
| |||||||||||
This function is called whenever the state of the view changes in such
a way that it impacts the state of drawables being shown.
| |||||||||||
This method was deprecated
in API level 20.
As of API 20 use
dispatchApplyWindowInsets(WindowInsets) to apply
insets to views. Views should override onApplyWindowInsets(WindowInsets) or use
setOnApplyWindowInsetsListener(android.view.View.OnApplyWindowInsetsListener)
to implement handling their own insets.
| |||||||||||
Returns the strength, or intensity, of the bottom faded edge.
| |||||||||||
Amount by which to extend the bottom fading region.
| |||||||||||
Views should implement this if they have extra information to associate
with the context menu.
| |||||||||||
Returns the height of the horizontal scrollbar.
| |||||||||||
Returns the strength, or intensity, of the left faded edge.
| |||||||||||
Amount by which to extend the left fading region.
| |||||||||||
Returns the strength, or intensity, of the right faded edge.
| |||||||||||
Amount by which to extend the right fading region.
| |||||||||||
Returns the suggested minimum height that the view should use.
| |||||||||||
Returns the suggested minimum width that the view should use.
| |||||||||||
Returns the strength, or intensity, of the top faded edge.
| |||||||||||
Amount by which to extend the top fading region.
| |||||||||||
If the View draws content inside its padding and enables fading edges,
it needs to support padding offsets.
| |||||||||||
Merge your own state values in additionalState into the base
state values baseState that were returned by
onCreateDrawableState(int) .
| |||||||||||
Invoked by a parent ViewGroup to notify the end of the animation
currently associated with this view.
| |||||||||||
Invoked by a parent ViewGroup to notify the start of the animation
currently associated with this view.
| |||||||||||
This is called when the view is attached to a window.
| |||||||||||
Called when the current configuration of the resources being used
by the application have changed.
| |||||||||||
Views should implement this if the view itself is going to add items to
the context menu.
| |||||||||||
Generate the new
Drawable state for
this view.
| |||||||||||
This is called when the view is detached from a window.
| |||||||||||
Gives this view a hint about whether is displayed or not.
| |||||||||||
Implement this to do your drawing.
| |||||||||||
Request the drawing of the horizontal and the vertical scrollbar. | |||||||||||
Finalize inflating a view from XML.
| |||||||||||
Called by the view system when the focus state of this view changes.
| |||||||||||
Called from layout when this view should
assign a size and position to each of its children.
| |||||||||||
Measure the view and its content to determine the measured width and the measured height. | |||||||||||
Called by
overScrollBy(int, int, int, int, int, int, int, int, boolean) to
respond to the results of an over-scroll operation.
| |||||||||||
Hook allowing a view to re-apply a representation of its internal state that had previously
been generated by
onSaveInstanceState() .
| |||||||||||
Hook allowing a view to generate a representation of its internal state
that can later be used to create a new instance with that same state.
| |||||||||||
This is called in response to an internal scroll in this view (i.e., the
view scrolled its own contents).
| |||||||||||
Invoked if there is a Transform that involves alpha.
| |||||||||||
This is called during layout when the size of this view has changed.
| |||||||||||
Called when the visibility of the view or an ancestor of the view has
changed.
| |||||||||||
Scroll the view with standard behavior for scrolling beyond the normal
content boundaries.
| |||||||||||
This method must be called by | |||||||||||
If your view subclass is displaying its own Drawable objects, it should
override this function and return true for any Drawable it is
displaying.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() |
Indicates to accessibility services whether the user should be notified when this view changes.
May be an integer value, such as "100
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
May be one of the following constant values.
Constant | Value | Description |
---|---|---|
none | 0 | Accessibility services should not announce changes to this view. |
polite | 1 | Accessibility services should announce changes to this view. |
assertive | 2 | Accessibility services should interrupt ongoing speech to immediately announce changes to this view. |
This corresponds to the global attribute
resource symbol accessibilityLiveRegion
.
Sets the id of a view after which this one is visited in accessibility traversal. A screen-reader must visit the content of the other view before the content of this one.
Sets the id of a view before which this one is visited in accessibility traversal. A screen-reader must visit the content of this view before the content of the one it precedes.
alpha property of the view, as a value between 0 (completely transparent) and 1 (completely opaque).
Must be a floating point value, such as "1.2
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute
resource symbol alpha
.
A drawable to use as the background. This can be either a reference to a full drawable resource (such as a PNG image, 9-patch, XML state list description, etc), or a solid color such as "#ff000000" (black).
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 background
.
Tint to apply to the background.
Must be a color value, in the form of "#rgb
", "#argb
",
"#rrggbb
", or "#aarrggbb
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute
resource symbol backgroundTint
.
Blending mode used to apply the background tint.
Must be one of the following constant values.
Constant | Value | Description |
---|---|---|
src_over | 3 | The tint is drawn on top of the drawable. [Sa + (1 - Sa)*Da, Rc = Sc + (1 - Sa)*Dc] |
src_in | 5 | The tint is masked by the alpha channel of the drawable. The drawable’s color channels are thrown out. [Sa * Da, Sc * Da] |
src_atop | 9 | The tint is drawn above the drawable, but with the drawable’s alpha channel masking the result. [Da, Sc * Da + (1 - Sa) * Dc] |
multiply | 14 | Multiplies the color and alpha channels of the drawable with those of the tint. [Sa * Da, Sc * Dc] |
screen | 15 | [Sa + Da - Sa * Da, Sc + Dc - Sc * Dc] |
add | 16 | Combines the tint and drawable color and alpha channels, clamping the result to valid color values. Saturate(S + D) |
This corresponds to the global attribute
resource symbol backgroundTintMode
.
Defines whether this view reacts to click events.
Must be a boolean value, either "true
" or "false
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute
resource symbol clickable
.
Defines text that briefly describes content of the view. This property is used primarily for accessibility. Since some views do not have textual representation this attribute can be used for providing such.
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 contentDescription
.
Defines whether this view reacts to context click events.
Must be a boolean value, either "true
" or "false
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute
resource symbol contextClickable
.
Defines the quality of translucent drawing caches. This property is used only when the drawing cache is enabled and translucent. The default value is auto.
Must be one of the following constant values.
Constant | Value | Description |
---|---|---|
auto | 0 | Lets the framework decide what quality level should be used for the drawing cache. |
low | 1 | Low quality. When set to low quality, the drawing cache uses a lower color depth, thus losing precision in rendering gradients, but uses less memory. |
high | 2 | High quality. When set to high quality, the drawing cache uses a higher color depth but uses more memory. |
This corresponds to the global attribute
resource symbol drawingCacheQuality
.
When this attribute is set to true, the view gets its drawable state (focused, pressed, etc.) from its direct parent rather than from itself.
Must be a boolean value, either "true
" or "false
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute
resource symbol duplicateParentState
.
base z depth of the view
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 elevation
.
Defines whether to fade out scrollbars when they are not in use.
Must be a boolean value, either "true
" or "false
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute
resource symbol fadeScrollbars
.
Defines the length of the fading edges.
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 fadingEdgeLength
.
Specifies whether to filter touches when the view's window is obscured by
another visible window. When set to true, the view will not receive touches
whenever a toast, dialog or other window appears above the view's window.
Refer to the View
security documentation for more details.
Must be a boolean value, either "true
" or "false
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute
resource symbol filterTouchesWhenObscured
.
Boolean internal attribute to adjust view layout based on system windows such as the status bar. If true, adjusts the padding of this view to leave space for the system windows. Will only take effect if this view is in a non-embedded activity.
Must be a boolean value, either "true
" or "false
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute
resource symbol fitsSystemWindows
.
Boolean that controls whether a view can take focus. By default the user can not
move focus to a view; by setting this attribute to true the view is
allowed to take focus. This value does not impact the behavior of
directly calling requestFocus()
, which will
always request focus regardless of this view. It only impacts where
focus navigation will try to move focus.
Must be a boolean value, either "true
" or "false
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute
resource symbol focusable
.
Boolean that controls whether a view can take focus while in touch mode. If this is true for a view, that view can gain focus when clicked on, and can keep focus if another view is clicked on that doesn't have this attribute set to true.
Must be a boolean value, either "true
" or "false
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute
resource symbol focusableInTouchMode
.
Defines the drawable to draw over the content. This can be used as an overlay. The foreground drawable participates in the padding of the content if the gravity is set to fill.
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 foreground
.
Defines the gravity to apply to the foreground drawable. The gravity defaults to fill.
Must be one or more (separated by '|') of the following constant values.
Constant | Value | Description |
---|---|---|
top | 0x30 | Push object to the top of its container, not changing its size. |
bottom | 0x50 | Push object to the bottom of its container, not changing its size. |
left | 0x03 | Push object to the left of its container, not changing its size. |
right | 0x05 | Push object to the right of its container, not changing its size. |
center_vertical | 0x10 | Place object in the vertical center of its container, not changing its size. |
fill_vertical | 0x70 | Grow the vertical size of the object if needed so it completely fills its container. |
center_horizontal | 0x01 | Place object in the horizontal center of its container, not changing its size. |
fill_horizontal | 0x07 | Grow the horizontal size of the object if needed so it completely fills its container. |
center | 0x11 | Place the object in the center of its container in both the vertical and horizontal axis, not changing its size. |
fill | 0x77 | Grow the horizontal and vertical size of the object if needed so it completely fills its container. |
clip_vertical | 0x80 | Additional option that can be set to have the top and/or bottom edges of the child clipped to its container's bounds. The clip will be based on the vertical gravity: a top gravity will clip the bottom edge, a bottom gravity will clip the top edge, and neither will clip both edges. |
clip_horizontal | 0x08 | Additional option that can be set to have the left and/or right edges of the child clipped to its container's bounds. The clip will be based on the horizontal gravity: a left gravity will clip the right edge, a right gravity will clip the left edge, and neither will clip both edges. |
This corresponds to the global attribute
resource symbol foregroundGravity
.
Tint to apply to the foreground.
Must be a color value, in the form of "#rgb
", "#argb
",
"#rrggbb
", or "#aarrggbb
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute
resource symbol foregroundTint
.
Blending mode used to apply the foreground tint.
Must be one of the following constant values.
Constant | Value | Description |
---|---|---|
src_over | 3 | The tint is drawn on top of the drawable. [Sa + (1 - Sa)*Da, Rc = Sc + (1 - Sa)*Dc] |
src_in | 5 | The tint is masked by the alpha channel of the drawable. The drawable’s color channels are thrown out. [Sa * Da, Sc * Da] |
src_atop | 9 | The tint is drawn above the drawable, but with the drawable’s alpha channel masking the result. [Da, Sc * Da + (1 - Sa) * Dc] |
multiply | 14 | Multiplies the color and alpha channels of the drawable with those of the tint. [Sa * Da, Sc * Dc] |
screen | 15 | [Sa + Da - Sa * Da, Sc + Dc - Sc * Dc] |
add | 16 | Combines the tint and drawable color and alpha channels, clamping the result to valid color values. Saturate(S + D) |
This corresponds to the global attribute
resource symbol foregroundTintMode
.
Boolean that controls whether a view should have haptic feedback enabled for events such as long presses.
Must be a boolean value, either "true
" or "false
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute
resource symbol hapticFeedbackEnabled
.
Supply an identifier name for this view, to later retrieve it
with View.findViewById()
or
Activity.findViewById()
.
This must be a
resource reference; typically you set this using the
@+
syntax to create a new ID resources.
For example: android:id="@+id/my_id"
which
allows you to later retrieve the view
with findViewById(R.id.my_id)
.
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 id
.
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. Note: While not recommended, an accessibility service may decide to ignore this attribute and operate on all views in the view tree.
May be an integer value, such as "100
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
May be one of the following constant values.
Constant | Value | Description |
---|---|---|
auto | 0 | The system determines whether the view is important for accessibility - default (recommended). |
yes | 1 | The view is important for accessibility. |
no | 2 | The view is not important for accessibility. |
noHideDescendants | 4 | The view is not important for accessibility, nor are any of its descendant views. |
This corresponds to the global attribute
resource symbol importantForAccessibility
.
Set this if the view will serve as a scrolling container, meaning that it can be resized to shrink its overall window so that there will be space for an input method. If not set, the default value will be true if "scrollbars" has the vertical scrollbar set, else it will be false.
Must be a boolean value, either "true
" or "false
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute
resource symbol isScrollContainer
.
Controls whether the view's window should keep the screen on while visible.
Must be a boolean value, either "true
" or "false
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute
resource symbol keepScreenOn
.
Specifies the type of layer backing this view. The default value is none.
Refer to setLayerType(int, android.graphics.Paint)
for more information.
Must be one of the following constant values.
Constant | Value | Description |
---|---|---|
none | 0 | Don't use a layer. |
software | 1 | Use a software layer. Refer to
setLayerType(int, android.graphics.Paint) for
more information. |
hardware | 2 | Use a hardware layer. Refer to
setLayerType(int, android.graphics.Paint) for
more information. |
This corresponds to the global attribute
resource symbol layerType
.
Defines the direction of layout drawing. This typically is associated with writing direction of the language script used. The possible values are "ltr" for Left-to-Right, "rtl" for Right-to-Left, "locale" and "inherit" from parent view. If there is nothing to inherit, "locale" is used. "locale" falls back to "en-US". "ltr" is the direction used in "en-US". The default for this attribute is "inherit".
Must be one of the following constant values.
Constant | Value | Description |
---|---|---|
ltr | 0 | Left-to-Right |
rtl | 1 | Right-to-Left |
inherit | 2 | Inherit from parent |
locale | 3 | Locale |
This corresponds to the global attribute
resource symbol layoutDirection
.
Defines whether this view reacts to long click events.
Must be a boolean value, either "true
" or "false
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute
resource symbol longClickable
.
Defines the minimum height of the view. It is not guaranteed the view will be able to achieve this minimum height (for example, if its parent layout constrains it with less available height).
Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp
".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute
resource symbol minHeight
.
Defines the minimum width of the view. It is not guaranteed the view will be able to achieve this minimum width (for example, if its parent layout constrains it with less available width).
Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp
".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute
resource symbol minWidth
.
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.
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 nextFocusDown
.
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.
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 nextFocusForward
.
Defines the next view to give focus to when the next focus is
FOCUS_LEFT
.
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.
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 nextFocusLeft
.
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.
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 nextFocusRight
.
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.
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 nextFocusUp
.
Name of the method in this View's context to invoke when the view is
clicked. This name must correspond to a public method that takes
exactly one parameter of type View. For instance, if you specify
android:onClick="sayHello"
, you must declare a
public void sayHello(View v)
method of your context
(typically, your Activity).
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 onClick
.
Sets the padding, in pixels, of all four edges. Padding is defined as
space between the edges of the view and the view's content. A views size
will include it's padding. If a background
is provided, the padding will initially be set to that (0 if the
drawable does not have padding). Explicitly setting a padding value
will override the corresponding padding found in the background.
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 padding
.
Sets the padding, in pixels, of the bottom edge; see padding
.
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 paddingBottom
.
Sets the padding, in pixels, of the end edge; see padding
.
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 paddingEnd
.
Sets the padding, in pixels, of the left edge; see padding
.
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 paddingLeft
.
Sets the padding, in pixels, of the right edge; see padding
.
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 paddingRight
.
Sets the padding, in pixels, of the start edge; see padding
.
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 paddingStart
.
Sets the padding, in pixels, of the top edge; see padding
.
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 paddingTop
.
Defines which edges should be faded on scrolling.
Must be one or more (separated by '|') of the following constant values.
Constant | Value | Description |
---|---|---|
none | 0x00000000 | No edge is faded. |
horizontal | 0x00001000 | Fades horizontal edges only. |
vertical | 0x00002000 | Fades vertical edges only. |
This corresponds to the global attribute
resource symbol requiresFadingEdge
.
rotation of the view, in degrees.
Must be a floating point value, such as "1.2
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute
resource symbol rotation
.
rotation of the view around the x axis, in degrees.
Must be a floating point value, such as "1.2
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute
resource symbol rotationX
.
rotation of the view around the y axis, in degrees.
Must be a floating point value, such as "1.2
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute
resource symbol rotationY
.
If false, no state will be saved for this view when it is being frozen. The default is true, allowing the view to be saved (however it also must have an ID assigned to it for its state to be saved). Setting this to false only disables the state for this view, not for its children which may still be saved.
Must be a boolean value, either "true
" or "false
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute
resource symbol saveEnabled
.
scale of the view in the x direction.
Must be a floating point value, such as "1.2
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute
resource symbol scaleX
.
scale of the view in the y direction.
Must be a floating point value, such as "1.2
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute
resource symbol scaleY
.
Defines which scroll indicators should be displayed when the view can be scrolled. Multiple values may be combined using logical OR, for example "top|bottom".
Must be one or more (separated by '|') of the following constant values.
Constant | Value | Description |
---|---|---|
none | 0x00 | No scroll indicators are displayed. |
top | 0x01 | Displays top scroll indicator when view can be scrolled up. |
bottom | 0x02 | Displays bottom scroll indicator when vew can be scrolled down. |
left | 0x04 | Displays left scroll indicator when vew can be scrolled left. |
right | 0x08 | Displays right scroll indicator when vew can be scrolled right. |
start | 0x10 | Displays right scroll indicator when vew can be scrolled in the start direction. |
end | 0x20 | Displays right scroll indicator when vew can be scrolled in the end direction. |
This corresponds to the global attribute
resource symbol scrollIndicators
.
The initial horizontal scroll offset, in pixels.
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 scrollX
.
The initial vertical scroll offset, in pixels.
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 scrollY
.
Defines whether the horizontal scrollbar track should always be drawn.
Must be a boolean value, either "true
" or "false
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute
resource symbol scrollbarAlwaysDrawHorizontalTrack
.
Defines whether the vertical scrollbar track should always be drawn.
Must be a boolean value, either "true
" or "false
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute
resource symbol scrollbarAlwaysDrawVerticalTrack
.
Defines the delay in milliseconds that a scrollbar waits before fade out.
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 scrollbarDefaultDelayBeforeFade
.
Defines the delay in milliseconds that a scrollbar takes to fade out.
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 scrollbarFadeDuration
.
Sets the width of vertical scrollbars and height of horizontal scrollbars.
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 scrollbarSize
.
Controls the scrollbar style and position. The scrollbars can be overlaid or inset. When inset, they add to the padding of the view. And the scrollbars can be drawn inside the padding area or on the edge of the view. For example, if a view has a background drawable and you want to draw the scrollbars inside the padding specified by the drawable, you can use insideOverlay or insideInset. If you want them to appear at the edge of the view, ignoring the padding, then you can use outsideOverlay or outsideInset.
Must be one of the following constant values.
Constant | Value | Description |
---|---|---|
insideOverlay | 0x0 | Inside the padding and overlaid |
insideInset | 0x01000000 | Inside the padding and inset |
outsideOverlay | 0x02000000 | Edge of the view and overlaid |
outsideInset | 0x03000000 | Edge of the view and inset |
This corresponds to the global attribute
resource symbol scrollbarStyle
.
Defines the horizontal scrollbar thumb drawable.
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 scrollbarThumbHorizontal
.
Defines the vertical scrollbar thumb drawable.
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 scrollbarThumbVertical
.
Defines the horizontal scrollbar track drawable.
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 scrollbarTrackHorizontal
.
Defines the vertical scrollbar track drawable.
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 scrollbarTrackVertical
.
Defines which scrollbars should be displayed on scrolling or not.
Must be one or more (separated by '|') of the following constant values.
Constant | Value | Description |
---|---|---|
none | 0x00000000 | No scrollbar is displayed. |
horizontal | 0x00000100 | Displays horizontal scrollbar only. |
vertical | 0x00000200 | Displays vertical scrollbar only. |
This corresponds to the global attribute
resource symbol scrollbars
.
Boolean that controls whether a view should have sound effects enabled for events such as clicking and touching.
Must be a boolean value, either "true
" or "false
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute
resource symbol soundEffectsEnabled
.
Sets the state-based animator for the View.
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 stateListAnimator
.
Supply a tag for this view containing a String, to be retrieved
later with View.getTag()
or
searched for with View.findViewWithTag()
. It is generally preferable to use
IDs (through the android:id attribute) instead of tags because
they are faster and allow for compile-time type checking.
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 tag
.
Defines the alignment of the text. A heuristic is used to determine the resolved text alignment.
May be an integer value, such as "100
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
May be one of the following constant values.
Constant | Value | Description |
---|---|---|
inherit | 0 | Default |
gravity | 1 | Default for the root view. The gravity determines the alignment, ALIGN_NORMAL, ALIGN_CENTER, or ALIGN_OPPOSITE, which are relative to each paragraph’s text direction |
textStart | 2 | Align to the start of the paragraph, e.g. ALIGN_NORMAL. |
textEnd | 3 | Align to the end of the paragraph, e.g. ALIGN_OPPOSITE. |
center | 4 | Center the paragraph, e.g. ALIGN_CENTER. |
viewStart | 5 | Align to the start of the view, which is ALIGN_LEFT if the view’s resolved layoutDirection is LTR, and ALIGN_RIGHT otherwise. |
viewEnd | 6 | Align to the end of the view, which is ALIGN_RIGHT if the view’s resolved layoutDirection is LTR, and ALIGN_LEFT otherwise |
This corresponds to the global attribute
resource symbol textAlignment
.
Defines the direction of the text. A heuristic is used to determine the resolved text direction of paragraphs.
May be an integer value, such as "100
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
May be one of the following constant values.
Constant | Value | Description |
---|---|---|
inherit | 0 | Default |
firstStrong | 1 | Default for the root view. The first strong directional character determines the paragraph direction. If there is no strong directional character, the paragraph direction is the view’s resolved layout direction. |
anyRtl | 2 | The paragraph direction is RTL if it contains any strong RTL character, otherwise it is LTR if it contains any strong LTR characters. If there are neither, the paragraph direction is the view’s resolved layout direction. |
ltr | 3 | The paragraph direction is left to right. |
rtl | 4 | The paragraph direction is right to left. |
locale | 5 | The paragraph direction is coming from the system Locale. |
firstStrongLtr | 6 | The first strong directional character determines the paragraph direction. If there is no strong directional character, the paragraph direction is LTR. |
firstStrongRtl | 7 | The first strong directional character determines the paragraph direction. If there is no strong directional character, the paragraph direction is RTL. |
This corresponds to the global attribute
resource symbol textDirection
.
x location of the pivot point around which the view will rotate and scale. This xml attribute sets the pivotX property of the View.
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 transformPivotX
.
y location of the pivot point around which the view will rotate and scale. This xml attribute sets the pivotY property of the View.
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 transformPivotY
.
Names a View such that it can be identified for Transitions. Names should be unique in the View hierarchy.
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 transitionName
.
translation in x of the view. This value is added post-layout to the left property of the view, which is set by its layout.
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 translationX
.
translation in y of the view. This value is added post-layout to the top property of the view, which is set by its layout.
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 translationY
.
translation in z of the view. This value is added to its elevation.
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 translationZ
.
Controls the initial visibility of the view.
Must be one of the following constant values.
Constant | Value | Description |
---|---|---|
visible | 0 | Visible on screen; the default value. |
invisible | 1 | Not displayed, but taken into account during layout (space is left for it). |
gone | 2 | Completely hidden, as if the view had not been added. |
This corresponds to the global attribute
resource symbol visibility
.
Live region mode specifying that accessibility services should interrupt ongoing speech to immediately announce changes to this view.
Use with setAccessibilityLiveRegion(int)
.
Live region mode specifying that accessibility services should not automatically announce changes to this view. This is the default live region mode for most views.
Use with setAccessibilityLiveRegion(int)
.
Live region mode specifying that accessibility services should announce changes to this view.
Use with setAccessibilityLiveRegion(int)
.
Enables automatic quality mode for the drawing cache.
Enables high quality mode for the drawing cache.
Enables low quality mode for the drawing cache.
Find find views that contain the specified content description.
Find views that render the specified text.
View flag indicating whether addFocusables(ArrayList, int, int)
should add all focusable Views regardless if they are focusable in touch mode.
View flag indicating whether addFocusables(ArrayList, int, int)
should add only Views focusable in touch mode.
Use with focusSearch(int)
. Move focus to the previous selectable
item.
Use with focusSearch(int)
. Move focus down.
Use with focusSearch(int)
. Move focus to the next selectable
item.
Use with focusSearch(int)
. Move focus to the left.
Use with focusSearch(int)
. Move focus to the right.
Use with focusSearch(int)
. Move focus up.
This view is invisible, and it doesn't take any space for layout
purposes. Use with setVisibility(int)
and android:visibility
.
View flag indicating whether this view should have haptic feedback enabled for events such as long presses.
Automatically determine whether a view is important for accessibility.
The view is not important for accessibility.
The view is not important for accessibility, nor are any of its descendant views.
The view is important for accessibility.
This view is invisible, but it still takes up space for layout purposes.
Use with setVisibility(int)
and android:visibility
.
View flag indicating that the screen should remain on while the
window containing this view is visible to the user. This effectively
takes care of automatically setting the WindowManager's
FLAG_KEEP_SCREEN_ON
.
Indicates that the view has a hardware layer. A hardware layer is backed
by a hardware specific texture (generally Frame Buffer Objects or FBO on
OpenGL hardware) and causes the view to be rendered using Android's hardware
rendering pipeline, but only if hardware acceleration is turned on for the
view hierarchy. When hardware acceleration is turned off, hardware layers
behave exactly as software layers
.
A hardware layer is useful to apply a specific color filter and/or blending mode and/or translucency to a view and all its children.
A hardware layer can be used to cache a complex view tree into a texture and reduce the complexity of drawing operations. For instance, when animating a complex view tree with a translation, a hardware layer can be used to render the view tree only once.
A hardware layer can also be used to increase the rendering quality when rotation transformations are applied on a view. It can also be used to prevent potential clipping issues when applying 3D transforms on a view.
Indicates that the view does not have a layer.
Indicates that the view has a software layer. A software layer is backed by a bitmap and causes the view to be rendered using Android's software rendering pipeline, even if hardware acceleration is enabled.
Software layers have various usages:
When the application is not using hardware acceleration, a software layer is useful to apply a specific color filter and/or blending mode and/or translucency to a view and all its children.
When the application is using hardware acceleration, a software layer is useful to render drawing primitives not supported by the hardware accelerated pipeline. It can also be used to cache a complex view tree into a texture and reduce the complexity of drawing operations. For instance, when animating a complex view tree with a translation, a software layer can be used to render the view tree only once.
Software layers should be avoided when the affected view tree updates often. Every update will require to re-render the software layer, which can potentially be slow (particularly when hardware acceleration is turned on since the layer will have to be uploaded into a hardware texture after every update.)
Horizontal layout direction of this view is inherited from its parent.
Use with setLayoutDirection(int)
.
Horizontal layout direction of this view is from deduced from the default language
script for the locale. Use with setLayoutDirection(int)
.
Horizontal layout direction of this view is from Left to Right.
Use with setLayoutDirection(int)
.
Horizontal layout direction of this view is from Right to Left.
Use with setLayoutDirection(int)
.
Bit 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)
.
Bits of getMeasuredWidthAndState()
and
getMeasuredWidthAndState()
that provide the actual measured size.
Bits of getMeasuredWidthAndState()
and
getMeasuredWidthAndState()
that provide the additional state bits.
Bit of getMeasuredWidthAndState()
and
getMeasuredWidthAndState()
that indicates the measured size
is smaller that the space the view would like to have.
Used to mark a View that has no ID.
Always allow a user to over-scroll this view, provided it is a view that can scroll.
Allow 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.
Never allow a user to over-scroll this view.
Indicates that the screen has changed state and is now off.
Indicates that the screen has changed state and is now on.
The scrollbar style to display the scrollbars inside the padded area, increasing the padding of the view. The scrollbars will not overlap the content area of the view.
The scrollbar style to display the scrollbars inside the content area, without increasing the padding. The scrollbars will be overlaid with translucency on the view's content.
The scrollbar style to display the scrollbars at the edge of the view, increasing the padding of the view. The scrollbars will only overlap the background, if any.
The scrollbar style to display the scrollbars at the edge of the view, without increasing the padding. The scrollbars will be overlaid with translucency.
Position the scroll bar at the default position as determined by the system.
Position the scroll bar along the left edge.
Position the scroll bar along the right edge.
Indicates scrolling along the horizontal axis.
Indicates no axis of view scrolling.
Indicates scrolling along the vertical axis.
Scroll indicator direction for the bottom edge of the view.
Scroll indicator direction for the ending edge of the view.
Resolved according to the view's layout direction, see
getLayoutDirection()
for more information.
Scroll indicator direction for the left edge of the view.
Scroll indicator direction for the right edge of the view.
Scroll indicator direction for the starting edge of the view.
Resolved according to the view's layout direction, see
getLayoutDirection()
for more information.
Scroll indicator direction for the top edge of the view.
View flag indicating whether this view should have sound effects enabled for events such as clicking and touching.
This constant was deprecated
in API level 14.
Use SYSTEM_UI_FLAG_LOW_PROFILE
instead.
This constant was deprecated
in API level 14.
Use SYSTEM_UI_FLAG_VISIBLE
instead.
Flag 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.
This has the same visual effect as
WindowManager.LayoutParams.FLAG_FULLSCREEN
,
meaning that non-critical screen decorations (such as the status bar) will be
hidden while the user is in the View's window, focusing the experience on
that content. Unlike the window flag, if you are using ActionBar in
overlay mode with Window.FEATURE_ACTION_BAR_OVERLAY
, then enabling this flag will also
hide the action bar.
This approach to going fullscreen is best used over the window flag when
it is a transient state -- that is, the application does this at certain
points in its user interaction where it wants to allow the user to focus
on content, but not as a continuous state. For situations where the application
would like to simply stay full screen the entire time (such as a game that
wants to take over the screen), the
window flag
is usually a better approach. The state set here will be removed by the system
in various situations (such as the user moving to another application) like
the other system UI states.
When using this flag, the application should provide some easy facility for the user to go out of it. A common example would be in an e-book reader, where tapping on the screen brings back whatever screen and UI decorations that had been hidden while the user was immersed in reading the book.
Flag for setSystemUiVisibility(int)
: View has requested that the
system navigation be temporarily hidden.
This is an even less obtrusive state than that called for by
SYSTEM_UI_FLAG_LOW_PROFILE
; on devices that draw essential navigation controls
(Home, Back, and the like) on screen, SYSTEM_UI_FLAG_HIDE_NAVIGATION
will cause
those to disappear. This is useful (in conjunction with the
FLAG_FULLSCREEN
and
FLAG_LAYOUT_IN_SCREEN
window flags) for displaying content using every last pixel on the display.
There is a limitation: because navigation controls are so important, the least user
interaction will cause them to reappear immediately. When this happens, both
this flag and SYSTEM_UI_FLAG_FULLSCREEN
will be cleared automatically,
so that both elements reappear at the same time.
Flag for setSystemUiVisibility(int)
: View would like to remain interactive when
hiding the navigation bar with SYSTEM_UI_FLAG_HIDE_NAVIGATION
. If this flag is
not set, SYSTEM_UI_FLAG_HIDE_NAVIGATION
will be force cleared by the system on any
user interaction.
Since this flag is a modifier for SYSTEM_UI_FLAG_HIDE_NAVIGATION
, it only
has an effect when used in combination with that flag.
Flag 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
. Use this flag to create an immersive
experience while also hiding the system bars. If this flag is not set,
SYSTEM_UI_FLAG_HIDE_NAVIGATION
will be force cleared by the system on any user
interaction, and SYSTEM_UI_FLAG_FULLSCREEN
will be force-cleared by the system
if the user swipes from the top of the screen.
When system bars are hidden in immersive mode, they can be revealed temporarily with system gestures, such as swiping from the top of the screen. These transient system bars will overlay app’s content, may have some degree of transparency, and will automatically hide after a short timeout.
Since this flag is a modifier for SYSTEM_UI_FLAG_FULLSCREEN
and
SYSTEM_UI_FLAG_HIDE_NAVIGATION
, it only has an effect when used in combination
with one or both of those flags.
Flag for setSystemUiVisibility(int)
: View would like its window
to be laid out as if it has requested
SYSTEM_UI_FLAG_FULLSCREEN
, even if it currently hasn't. This
allows it to avoid artifacts when switching in and out of that mode, at
the expense that some of its user interface may be covered by screen
decorations when they are shown. You can perform layout of your inner
UI elements to account for non-fullscreen system UI through the
fitSystemWindows(Rect)
method.
Flag for setSystemUiVisibility(int)
: View would like its window
to be laid out as if it has requested
SYSTEM_UI_FLAG_HIDE_NAVIGATION
, even if it currently hasn't. This
allows it to avoid artifacts when switching in and out of that mode, at
the expense that some of its user interface may be covered by screen
decorations when they are shown. You can perform layout of your inner
UI elements to account for the navigation system UI through the
fitSystemWindows(Rect)
method.
Flag for setSystemUiVisibility(int)
: When using other layout
flags, we would like a stable view of the content insets given to
fitSystemWindows(Rect)
. This means that the insets seen there
will always represent the worst case that the application can expect
as a continuous state. In the stock Android UI this is the space for
the system bar, nav bar, and status bar, but not more transient elements
such as an input method.
The stable layout your UI sees is based on the system UI modes you can
switch to. That is, if you specify SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
then you will get a stable layout for changes of the
SYSTEM_UI_FLAG_FULLSCREEN
mode; if you specify
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
and
SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
, then you can transition
to SYSTEM_UI_FLAG_FULLSCREEN
and SYSTEM_UI_FLAG_HIDE_NAVIGATION
with a stable layout. (Note that you should avoid using
SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
by itself.)
If you have set the window flag FLAG_FULLSCREEN
to hide the status bar (instead of using SYSTEM_UI_FLAG_FULLSCREEN
),
then a hidden status bar will be considered a "stable" state for purposes
here. This allows your UI to continually hide the status bar, while still
using the system UI flags to hide the action bar while still retaining
a stable layout. Note that changing the window fullscreen flag will never
provide a stable layout for a clean transition.
If you are using ActionBar in
overlay mode with Window.FEATURE_ACTION_BAR_OVERLAY
, this flag will also impact the
insets it adds to those given to the application.
Flag for setSystemUiVisibility(int)
: Requests the status bar to draw in a mode that
is compatible with light status bar backgrounds.
For this to take effect, the window must request
FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
but not
FLAG_TRANSLUCENT_STATUS
.
Flag for setSystemUiVisibility(int)
: View has requested the
system UI to enter an unobtrusive "low profile" mode.
This is for use in games, book readers, video players, or any other "immersive" application where the usual system chrome is deemed too distracting.
In low profile mode, the status bar and/or navigation icons may dim.
Special constant for setSystemUiVisibility(int)
: View has
requested the system UI (status bar) to be visible (the default).
Flags that can impact the layout in relation to system UI.
Center the paragraph, e.g. ALIGN_CENTER.
Use with setTextAlignment(int)
Default for the root view. The gravity determines the text alignment, ALIGN_NORMAL,
ALIGN_CENTER, or ALIGN_OPPOSITE, which are relative to each paragraph’s text direction.
Use with setTextAlignment(int)
Default text alignment. The text alignment of this View is inherited from its parent.
Use with setTextAlignment(int)
Align to the end of the paragraph, e.g. ALIGN_OPPOSITE.
Use with setTextAlignment(int)
Align to the start of the paragraph, e.g. ALIGN_NORMAL.
Use with setTextAlignment(int)
Align to the end of the view, which is ALIGN_RIGHT if the view’s resolved
layoutDirection is LTR, and ALIGN_LEFT otherwise.
Use with setTextAlignment(int)
Align to the start of the view, which is ALIGN_LEFT if the view’s resolved
layoutDirection is LTR, and ALIGN_RIGHT otherwise.
Use with setTextAlignment(int)
Text direction is using "any-RTL" algorithm. The paragraph direction is RTL if it contains any strong RTL character, otherwise it is LTR if it contains any strong LTR characters. If there are neither, the paragraph direction is the view's resolved layout direction.
Text direction is using "first strong algorithm". The first strong directional character determines the paragraph direction. If there is no strong directional character, the paragraph direction is the view's resolved layout direction.
Text direction is using "first strong algorithm". The first strong directional character determines the paragraph direction. If there is no strong directional character, the paragraph direction is LTR.
Text direction is using "first strong algorithm". The first strong directional character determines the paragraph direction. If there is no strong directional character, the paragraph direction is RTL.
Text direction is inherited through ViewGroup
Text direction is coming from the system Locale.
Text direction is forced to LTR.
Text direction is forced to RTL.
The logging tag used by this class with android.util.Log.
This view is visible.
Use with setVisibility(int)
and android:visibility
.
A Property wrapper around the alpha
functionality handled by the
setAlpha(float)
and getAlpha()
methods.
Indicates the view has no states set. States are used with
Drawable
to change the drawing of the
view depending on its state.
Indicates the view is enabled, focused and selected.
Indicates the view is enabled, focused, selected and its window has the focus.
Indicates the view is enabled and has the focus.
Indicates the view is enabled, focused and its window has the focus.
Indicates the view is enabled and selected.
Indicates the view is enabled, selected and its window has the focus.
Indicates the view is enabled. States are used with
Drawable
to change the drawing of the
view depending on its state.
Indicates the view is enabled and that its window has focus.
Indicates the view is focused and selected.
Indicates the view is focused, selected and its window has the focus.
Indicates the view is focused. States are used with
Drawable
to change the drawing of the
view depending on its state.
Indicates the view has the focus and that its window has the focus.
Indicates the view is pressed, enabled, focused and selected.
Indicates the view is pressed, enabled, focused, selected and its window has the focus.
Indicates the view is pressed, enabled and focused.
Indicates the view is pressed, enabled, focused and its window has the focus.
Indicates the view is pressed, enabled and selected.
Indicates the view is pressed, enabled, selected and its window has the focus.
Indicates the view is pressed and enabled.
Indicates the view is pressed, enabled and its window has the focus.
Indicates the view is pressed, focused and selected.
Indicates the view is pressed, focused, selected and its window has the focus.
Indicates the view is pressed and focused.
Indicates the view is pressed, focused and its window has the focus.
Indicates the view is pressed and selected.
Indicates the view is pressed, selected and its window has the focus.
Indicates the view is pressed. States are used with
Drawable
to change the drawing of the
view depending on its state.
Indicates the view is pressed and its window has the focus.
A Property wrapper around the rotation
functionality handled by the
setRotation(float)
and getRotation()
methods.
A Property wrapper around the rotationX
functionality handled by the
setRotationX(float)
and getRotationX()
methods.
A Property wrapper around the rotationY
functionality handled by the
setRotationY(float)
and getRotationY()
methods.
A Property wrapper around the scaleX
functionality handled by the
setScaleX(float)
and getScaleX()
methods.
A Property wrapper around the scaleY
functionality handled by the
setScaleY(float)
and getScaleY()
methods.
Indicates the view is selected. States are used with
Drawable
to change the drawing of the
view depending on its state.
Indicates the view is selected and that its window has the focus.
A Property wrapper around the translationX
functionality handled by the
setTranslationX(float)
and getTranslationX()
methods.
A Property wrapper around the translationY
functionality handled by the
setTranslationY(float)
and getTranslationY()
methods.
A Property wrapper around the translationZ
functionality handled by the
setTranslationZ(float)
and getTranslationZ()
methods.
Indicates the view's window has focus. States are used with
Drawable
to change the drawing of the
view depending on its state.
A Property wrapper around the x
functionality handled by the
setX(float)
and getX()
methods.
A Property wrapper around the y
functionality handled by the
setY(float)
and getY()
methods.
A Property wrapper around the z
functionality handled by the
setZ(float)
and getZ()
methods.
Simple constructor to use when creating a view from code.
context | The Context the view is running in, through which it can access the current theme, resources, etc. |
---|
Constructor that is called when inflating a view from XML. This is called when a view is being constructed from an XML file, supplying attributes that were specified in the XML file. This version uses a default style of 0, so the only attribute values applied are those in the Context's Theme and the given AttributeSet.
The method onFinishInflate() will be called after all children have been added.
context | The Context the view is running in, through which it can access the current theme, resources, etc. |
---|---|
attrs | The attributes of the XML tag that is inflating the view. |
Perform inflation from XML and apply a class-specific base style from a
theme attribute. This constructor of View allows subclasses to use their
own base style when they are inflating. For example, a Button class's
constructor would call this version of the super class constructor and
supply R.attr.buttonStyle
for defStyleAttr; this
allows the theme's button style to modify all of the base view attributes
(in particular its background) as well as the Button class's attributes.
context | The Context the view is running in, through which it can access the current theme, resources, etc. |
---|---|
attrs | The attributes of the XML tag that is inflating the view. |
defStyleAttr | An attribute in the current theme that contains a reference to a style resource that supplies default values for the view. Can be 0 to not look for defaults. |
Perform inflation from XML and apply a class-specific base style from a theme attribute or style resource. This constructor of View allows subclasses to use their own base style when they are inflating.
When determining the final value of a particular attribute, there are four inputs that come into play:
Each of these inputs is considered in-order, with the first listed taking
precedence over the following ones. In other words, if in the
AttributeSet you have supplied <Button * textColor="#ff000000">
, then the button's text will always be black, regardless of
what is specified in any of the styles.
context | The Context the view is running in, through which it can access the current theme, resources, etc. |
---|---|
attrs | The attributes of the XML tag that is inflating the view. |
defStyleAttr | An attribute in the current theme that contains a reference to a style resource that supplies default values for the view. Can be 0 to not look for defaults. |
defStyleRes | A resource identifier of a style resource that supplies default values for the view, used only if defStyleAttr is 0 or can not be found in the theme. Can be 0 to not look for defaults. |
Adds the children of this View relevant for accessibility to the given list as output. Since some Views are not important for accessibility the added child views are not necessarily direct children of this view, rather they are the first level of descendants important for accessibility.
outChildren | The output list that will receive children for accessibility. |
---|
Adds any focusable views that are descendants of this view (possibly including this view if it is focusable itself) to views. This method adds all focusable views regardless if we are in touch mode or only views focusable in touch mode if we are in touch mode or only views that can take accessibility focus if accessibility is enabled depending on the focusable mode parameter.
views | Focusable views found so far or null if all we are interested is the number of focusables. |
---|---|
direction | The direction of the focus. |
focusableMode | The type of focusables to be added. |
Add any focusable views that are descendants of this view (possibly including this view if it is focusable itself) to views. If we are in touch mode, only add views that are also focusable in touch mode.
views | Focusable views found so far |
---|---|
direction | The direction of the focus |
Add a listener for attach state changes.
This listener will be called whenever this view is attached or detached
from a window. Remove the listener using
removeOnAttachStateChangeListener(OnAttachStateChangeListener)
.
listener | Listener to attach |
---|
Add a listener that will be called when the bounds of the view change due to layout processing.
listener | The listener that will be called when layout bounds change. |
---|
Add any touchable views that are descendants of this view (possibly including this view if it is touchable itself) to views.
views | Touchable views found so far |
---|
This method returns a ViewPropertyAnimator object, which can be used to animate specific properties on this View.
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. For example, announcing a new page in a book. If accessibility
is not enabled this method does nothing.
text | The announcement text. |
---|
Change the view's z order in the tree, so it's on top of other sibling
views. This ordering change may affect layout, if the parent container
uses an order-dependent layout scheme (e.g., LinearLayout). Prior
to KITKAT
this
method should be followed by calls to requestLayout()
and
invalidate()
on the view's parent to force the parent to redraw
with the new child ordering.
Calling this method is equivalent to calling buildDrawingCache(false)
.
Forces the drawing cache to be built if the drawing cache is invalid.
If you call buildDrawingCache()
manually without calling
setDrawingCacheEnabled(true)
, you
should cleanup the cache by calling destroyDrawingCache()
afterwards.
Note about auto scaling in compatibility mode: When auto scaling is not enabled, this method will create a bitmap of the same size as this view. Because this bitmap will be drawn scaled by the parent ViewGroup, the result on screen might show scaling artifacts. To avoid such artifacts, you should call this method by setting the auto scaling to true. Doing so, however, will generate a bitmap of a different size than the view. This implies that your application must be able to handle this size.
You should avoid calling this method when hardware acceleration is enabled. If you do not need the drawing cache bitmap, calling this method will increase memory usage and cause the view to be rendered in software once, thus negatively impacting performance.
Forces this view's layer to be created and this view to be rendered
into its layer. If this view's layer type is set to LAYER_TYPE_NONE
,
invoking this method will have no effect.
This method can for instance be used to render a view into its layer before
starting an animation. If this view is complex, rendering into the layer
before starting the animation will avoid skipping frames.
IllegalStateException | If this view is not attached to a window |
---|
Directly call any attached OnClickListener. Unlike performClick()
,
this only calls the listener, and does not do any associated clicking
actions like reporting an accessibility event.
Check if layout direction resolution can be done.
Check if text alignment resolution can be done.
Check if text direction resolution can be done.
Check if this view can be scrolled horizontally in a certain direction.
direction | Negative to check scrolling left, positive to check scrolling right. |
---|
Check if this view can be scrolled vertically in a certain direction.
direction | Negative to check scrolling up, positive to check scrolling down. |
---|
Cancels a pending long press. Your subclass can use this if you want the context menu to come up if the user presses and holds at the same place, but you don't want it to come up if they press and then move around enough to cause scrolling.
Cancel any deferred high-level input events that were previously posted to the event queue.
Many views post high-level events such as click handlers to the event queue to run deferred in order to preserve a desired user experience - clearing visible pressed states before executing, etc. This method will abort any events of this nature that are currently in flight.
Custom views that generate their own high-level deferred input events should override
onCancelPendingInputEvents()
and remove those pending events from the queue.
This will also cancel pending input events for any child views.
Note that this may not be sufficient as a debouncing strategy for clicks in all cases.
This will not impact newer events posted after this call that may occur as a result of
lower-level input events still waiting in the queue. If you are trying to prevent
double-submitted events for the duration of some sort of asynchronous transaction
you should also take other steps to protect against unexpected double inputs e.g. calling
setEnabled(false)
and re-enabling the view when
the transaction completes, tracking already submitted transaction IDs, etc.
Called by the InputMethodManager
when a view who is not the current
input connection target is trying to make a call on the manager. The
default implementation returns false; you can override this to return
true for certain views if you are performing InputConnection proxying
to them.
view | The View that is making the InputMethodManager call. |
---|
Called when this view wants to give up focus. If focus is cleared
onFocusChanged(boolean, int, android.graphics.Rect)
is called.
Note: When a View clears focus the framework is trying to give focus to the first focusable View from the top. Hence, if this View is the first from the top that can take focus, then all callbacks related to clearing focus will be invoked after which the framework will give focus to this view.
Merge two states as returned by getMeasuredState()
.
curState | The current state as returned from a view or the result of combining multiple views. |
---|---|
newState | The new view state to combine. |
Called by a parent to request that a child update its values for mScrollX
and mScrollY if necessary. This will typically be done if the child is
animating a scroll using a Scroller
object.
Compute insets that should be consumed by this view and the ones that should propagate to those under it.
in | Insets currently being processed by this View, likely received as a parameter
to onApplyWindowInsets(WindowInsets) . |
---|---|
outLocalInsets | A Rect that will receive the insets that should be consumed by this view |
Returns an AccessibilityNodeInfo
representing this view from the
point of view of an AccessibilityService
.
This method is responsible for obtaining an accessibility node info from a
pool of reusable instances and calling
onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo)
on this view to
initialize the former.
Note: The client is responsible for recycling the obtained instance by calling
recycle()
to minimize object creation.
AccessibilityNodeInfo
.Show the context menu for this view. It is not safe to hold on to the
menu after returning from this method.
You should normally not overload this method. Overload
onCreateContextMenu(ContextMenu)
or define an
View.OnCreateContextMenuListener
to add items to the context menu.
menu | The context menu to populate |
---|
Frees the resources used by the drawing cache. If you call
buildDrawingCache()
manually without calling
setDrawingCacheEnabled(true)
, you
should cleanup the cache with this method afterwards.
Request to apply the given window insets to this view or another view in its subtree.
This method should be called by clients wishing to apply insets corresponding to areas obscured by window decorations or overlays. This can include the status and navigation bars, action bars, input methods and more. New inset categories may be added in the future. The method returns the insets provided minus any that were applied by this view or its children.
Clients wishing to provide custom behavior should override the
onApplyWindowInsets(WindowInsets)
method or alternatively provide a
View.OnApplyWindowInsetsListener
via the
setOnApplyWindowInsetsListener
method.
This method replaces the older fitSystemWindows
method.
insets | Insets to apply |
---|
Dispatch a notification about a resource configuration change down the view hierarchy. ViewGroups should override to route to their children.
newConfig | The new resource configuration. |
---|
Dispatch a hint about whether this view is displayed. 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.
Detects if this View is enabled and has a drag event listener.
If both are true, then it calls the drag event listener with the
DragEvent
it received. If the drag event listener returns
true
, then dispatchDragEvent() returns true
.
For all other cases, the method calls the
onDragEvent()
drag event handler
method and returns its result.
This ensures that a drag event is always consumed, even if the View does not have a drag event listener. However, if the View has a listener and the listener returns true, then onDragEvent() is not called.
Dispatches drawableHotspotChanged to all of this View's children.
x | hotspot x coordinate |
---|---|
y | hotspot y coordinate |
Dispatch a generic motion event.
Generic motion events with source class SOURCE_CLASS_POINTER
are delivered to the view under the pointer. All other generic motion events are
delivered to the focused view. Hover events are handled specially and are delivered
to onHoverEvent(MotionEvent)
.
event | The motion event to be dispatched. |
---|
Dispatch a key event to the next view on the focus path. This path runs from the top of the view tree down to the currently focused view. If this view has focus, it will dispatch to itself. Otherwise it will dispatch the next node down the focus path. This method also fires any key listeners.
event | The key event to be dispatched. |
---|
Dispatch 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.
event | The key event to be dispatched. |
---|
Dispatches a key shortcut event.
event | The key event to be dispatched. |
---|
Dispatch a fling to a nested scrolling parent.
This method should be used to indicate that a nested scrolling child has detected
suitable conditions for a fling. Generally this means that a touch scroll has ended with a
velocity
in the direction of scrolling that meets or exceeds
the minimum fling velocity
along a scrollable axis.
If a nested scrolling child view would normally fling but it is at the edge of its own content, it can use this method to delegate the fling to its nested scrolling parent instead. The parent may optionally consume the fling or observe a child fling.
velocityX | Horizontal fling velocity in pixels per second |
---|---|
velocityY | Vertical fling velocity in pixels per second |
consumed | true if the child consumed the fling, false otherwise |
Dispatch a fling to a nested scrolling parent before it is processed by this view.
Nested pre-fling events are to nested fling events what touch intercept is to touch
and what nested pre-scroll is to nested scroll. dispatchNestedPreFling
offsets an opportunity for the parent view in a nested fling to fully consume the fling
before the child view consumes it. If this method returns true
, a nested
parent view consumed the fling and this view should not scroll as a result.
For a better user experience, only one view in a nested scrolling chain should consume the fling at a time. If a parent view consumed the fling this method will return false. Custom view implementations should account for this in two ways:
dispatchNestedPreFling
; consume the fling and settle to a valid
position regardless.Views should also not offer fling velocities to nested parent views along an axis
where scrolling is not currently supported; a ScrollView
should not offer a horizontal fling velocity to its parents since scrolling along that
axis is not permitted and carrying velocity along that motion does not make sense.
velocityX | Horizontal fling velocity in pixels per second |
---|---|
velocityY | Vertical fling velocity in pixels per second |
Report an accessibility action to this view's parents for delegated processing.
Implementations of performAccessibilityAction(int, Bundle)
may internally
call this method to delegate an accessibility action to a supporting parent. If the parent
returns true from its
onNestedPrePerformAccessibilityAction(View, int, android.os.Bundle)
method this method will return true to signify that the action was consumed.
This method is useful for implementing nested scrolling child views. If
isNestedScrollingEnabled()
returns true and the action is a scrolling action
a custom view implementation may invoke this method to allow a parent to consume the
scroll first. If this method returns true the custom view should skip its own scrolling
behavior.
action | Accessibility action to delegate |
---|---|
arguments | Optional action arguments |
Dispatch one step of a nested scroll in progress before this view consumes any portion of it.
Nested pre-scroll events are to nested scroll events what touch intercept is to touch.
dispatchNestedPreScroll
offers an opportunity for the parent view in a nested
scrolling operation to consume some or all of the scroll operation before the child view
consumes it.
dx | Horizontal scroll distance in pixels |
---|---|
dy | Vertical scroll distance in pixels |
consumed | Output. If not null, consumed[0] will contain the consumed component of dx and consumed[1] the consumed dy. |
offsetInWindow | Optional. If not null, on return this will contain the offset in local view coordinates of this view from before this operation to after it completes. View implementations may use this to adjust expected input coordinate tracking. |
Dispatch one step of a nested scroll in progress.
Implementations of views that support nested scrolling should call this to report
info about a scroll in progress to the current nested scrolling parent. If a nested scroll
is not currently in progress or nested scrolling is not
enabled
for this view this method does nothing.
Compatible View implementations should also call
dispatchNestedPreScroll
before
consuming a component of the scroll event themselves.
dxConsumed | Horizontal distance in pixels consumed by this view during this scroll step |
---|---|
dyConsumed | Vertical distance in pixels consumed by this view during this scroll step |
dxUnconsumed | Horizontal scroll distance in pixels not consumed by this view |
dyUnconsumed | Horizontal scroll distance in pixels not consumed by this view |
offsetInWindow | Optional. If not null, on return this will contain the offset in local view coordinates of this view from before this operation to after it completes. View implementations may use this to adjust expected input coordinate tracking. |
Dispatches an AccessibilityEvent
to the View
first and then
to its children for adding their text content to the event. Note that the
event text is populated in a separate dispatch path since we add to the
event not only the text of the source but also the text of all its descendants.
A typical implementation will call
onPopulateAccessibilityEvent(AccessibilityEvent)
on the this view
and then call the dispatchPopulateAccessibilityEvent(AccessibilityEvent)
on each child. Override this method if custom population of the event text
content is required.
If an View.AccessibilityDelegate
has been specified via calling
setAccessibilityDelegate(AccessibilityDelegate)
its
dispatchPopulateAccessibilityEvent(View, AccessibilityEvent)
is responsible for handling this call.
Note: Accessibility events of certain types are not dispatched for
populating the event text via this method. For details refer to AccessibilityEvent
.
event | The event. |
---|
Dispatch creation of ViewStructure
down the hierarchy. The default
implementation calls onProvideStructure(ViewStructure)
and
onProvideVirtualStructure(ViewStructure)
.
Dispatch callbacks to setOnSystemUiVisibilityChangeListener(View.OnSystemUiVisibilityChangeListener)
down
the view hierarchy.
Pass the touch screen motion event down to the target view, or this view if it is the target.
event | The motion event to be dispatched. |
---|
Pass a trackball motion event down to the focused view.
event | The motion event to be dispatched. |
---|
This method is the last chance for the focused view and its ancestors to respond to an arrow key. This is called when the focused view did not consume the key internally, nor could the view system find a new view in the requested direction to give focus to.
focused | The currently focused view. |
---|---|
direction | The direction focus wants to move. One of FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, and FOCUS_RIGHT. |
Called when the window containing this view gains or loses window focus. ViewGroups should override to route to their children.
hasFocus | True if the window containing this view now has focus, false otherwise. |
---|
Dispatch callbacks to onWindowSystemUiVisibilityChanged(int)
down
the view hierarchy.
Dispatch a window visibility change down the view hierarchy. ViewGroups should override to route to their children.
visibility | The new visibility of the window. |
---|
Manually render this view (and all of its children) to the given Canvas.
The view must have already done a full layout before this function is
called. When implementing a view, implement
onDraw(android.graphics.Canvas)
instead of overriding this method.
If you do need to override this method, call the superclass version.
canvas | The Canvas to which the View is rendered. |
---|
This function is called whenever the view hotspot changes and needs to be propagated to drawables or child views managed by the view.
Dispatching to child views is handled by
dispatchDrawableHotspotChanged(float, float)
.
Be sure to call through to the superclass when overriding this function.
x | hotspot x coordinate |
---|---|
y | hotspot y coordinate |
Find the view in the hierarchy rooted at this view that currently has focus.
Look for a child view with the given id. If this view has the given id, return this view.
id | The id to search for. |
---|
Look for a child view with the given tag. If this view has the given tag, return this view.
tag | The tag to search for, using "tag.equals(getTag())". |
---|
Finds the Views that contain given text. The containment is case insensitive.
The search is performed by either the text that the View renders or the content
description that describes the view for accessibility purposes and the view does
not render or both. Clients can specify how the search is to be performed via
passing the FIND_VIEWS_WITH_TEXT
and
FIND_VIEWS_WITH_CONTENT_DESCRIPTION
flags.
outViews | The output list of matching Views. |
---|---|
searched | The text to match against. |
Find the nearest view in the specified direction that can take focus. This does not actually give focus to that view.
direction | One of FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, and FOCUS_RIGHT |
---|
Forces this view to be laid out during the next layout pass. This method does not call requestLayout() or forceLayout() on the parent.
Generate a value suitable for use in setId(int)
.
This value will not collide with ID values generated at build time by aapt for R.id.
Return the class name of this object to be used for accessibility purposes.
Subclasses should only override this if they are implementing something that
should be seen as a completely new class of view when used by accessibility,
unrelated to the class it is deriving from. This is used to fill in
AccessibilityNodeInfo.setClassName
.
Gets the live region mode for this View.
Gets the provider for managing a virtual view hierarchy rooted at this View
and reported to AccessibilityService
s
that explore the window content.
If this method returns an instance, this instance is responsible for managing
AccessibilityNodeInfo
s describing the virtual sub-tree rooted at this
View including the one representing the View itself. Similarly the returned
instance is responsible for performing accessibility actions on any virtual
view or the root view itself.
If an View.AccessibilityDelegate
has been specified via calling
setAccessibilityDelegate(AccessibilityDelegate)
its
getAccessibilityNodeProvider(View)
is responsible for handling this call.
Gets the id of a view after which this one is visited in accessibility traversal.
NO_ID
.Gets the id of a view before which this one is visited in accessibility traversal.
NO_ID
.The opacity of the view. This is a value from 0 to 1, where 0 means the view is completely transparent and 1 means the view is completely opaque.
By default this is 1.0f.
Get the animation currently associated with this view.
Retrieve a unique token identifying the top-level "real" window of
the window that this view is attached to. That is, this is like
getWindowToken()
, except if the window this view in is a panel
window (attached to another containing window), then the token of
the containing window is returned instead.
getWindowToken()
or the containing window's token.
Gets the background drawable
Return the tint applied to the background drawable, if specified.
Return the blending mode used to apply the tint to the background drawable, if specified.
Return the offset of the widget's text baseline from the widget's top boundary. If this widget does not support baseline alignment, this method returns -1.
Bottom position of this view relative to its parent.
Gets the distance along the Z axis from the camera to this view.
Returns a copy of the current clipBounds
.
Populates an output rectangle with the clip bounds of the view,
returning true
if successful or false
if the view's
clip bounds are null
.
outRect | rectangle in which to place the clip bounds of the view |
---|
true
if successful or false
if the view's
clip bounds are null
Returns whether the Outline should be used to clip the contents of the View.
Note that this flag will only be respected if the View's Outline returns true from
canClip()
.
Gets the View
description. It briefly describes the view and is
primarily used for accessibility support. Set this property to enable
better accessibility support for your application. This is especially
true for views that do not have textual representation (For example,
ImageButton).
Returns the context the view is running in, through which it can access the current theme, resources, etc.
Utility to return a default size. Uses the supplied size if the MeasureSpec imposed no constraints. Will get larger if allowed by the MeasureSpec.
size | Default size for this view |
---|---|
measureSpec | Constraints imposed by the parent |
Gets the logical display to which the view's window has been attached.
Return an array of resource IDs of the drawable states representing the current state of the view.
Returns the bitmap in which this view drawing is cached. The returned bitmap
is null when caching is disabled. If caching is enabled and the cache is not ready,
this method will create it. Calling draw(android.graphics.Canvas)
will not
draw from the cache when the cache is enabled. To benefit from the cache, you must
request the drawing cache by calling this method and draw it on screen if the
returned bitmap is not null.
Note about auto scaling in compatibility mode: When auto scaling is not enabled, this method will create a bitmap of the same size as this view. Because this bitmap will be drawn scaled by the parent ViewGroup, the result on screen might show scaling artifacts. To avoid such artifacts, you should call this method by setting the auto scaling to true. Doing so, however, will generate a bitmap of a different size than the view. This implies that your application must be able to handle this size.
autoScale | Indicates whether the generated bitmap should be scaled based on the current density of the screen when the application is in compatibility mode. |
---|
Calling this method is equivalent to calling getDrawingCache(false)
.
Returns the quality of the drawing cache.
Return the visible drawing bounds of your view. Fills in the output
rectangle with the values from getScrollX(), getScrollY(),
getWidth(), and getHeight(). These bounds do not account for any
transformation properties currently set on the view, such as
setScaleX(float)
or setRotation(float)
.
outRect | The (scrolled) drawing bounds of the view. |
---|
Return the time at which the drawing of the view hierarchy started.
The base elevation of this view relative to its parent, in pixels.
Gets whether the framework should discard touches when the view's
window is obscured by another visible window.
Refer to the View
security documentation for more details.
Check for state of setFitsSystemWindows(boolean)
. If this method
returns true
, the default implementation of fitSystemWindows(Rect)
will be executed.
true
if the default implementation of
fitSystemWindows(Rect)
will be executed.Find and return all focusable views that are descendants of this view, possibly including this view if it is focusable itself.
direction | The direction of the focus |
---|
When a view has focus and the user navigates away from it, the next view is searched for
starting from the rectangle filled in by this method.
By default, the rectangle is the getDrawingRect(android.graphics.Rect)
)
of the view. However, if your view maintains some idea of internal selection,
such as a cursor, or a selected row or column, you should override this method and
fill in a more specific rectangle.
r | The rectangle to fill in, in this view's coordinates. |
---|
Returns the drawable used as the foreground of this View. The foreground drawable, if non-null, is always drawn on top of the view's content.
Describes how the foreground is positioned.
Return the tint applied to the foreground drawable, if specified.
Return the blending mode used to apply the tint to the foreground drawable, if specified.
If some part of this view is not clipped by any of its parents, then return that area in r in global (root) coordinates. To convert r to local coordinates (without taking possible View rotations into account), offset it by -globalOffset (e.g. r.offset(-globalOffset.x, -globalOffset.y)). If the view is completely clipped or translated out, return false.
r | If true is returned, r holds the global coordinates of the visible portion of this view. |
---|---|
globalOffset | If true is returned, globalOffset holds the dx,dy between this view and its root. globalOffet may be null. |
Return the height of your view.
Hit rectangle in parent's coordinates
outRect | The hit rectangle of the view. |
---|
Returns the size of the horizontal faded edges used to indicate that more content in this view is visible.
Returns this view's identifier.
NO_ID
if the view has no IDGets 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.
Returns whether the screen should remain on, corresponding to the current
value of KEEP_SCREEN_ON
.
KEEP_SCREEN_ON
is set.Return the global KeyEvent.DispatcherState
for this view's window. Returns null if the view is not currently attached
to the window. Normally you will not need to use this directly, but
just use the standard high-level event callbacks like
onKeyDown(int, KeyEvent)
.
Gets the id of a view for which this view serves as a label for accessibility purposes.
Indicates what type of layer is currently associated with this view. By default
a view does not have a layer, and the layer type is LAYER_TYPE_NONE
.
Refer to the documentation of setLayerType(int, android.graphics.Paint)
for more information on the different types of layers.
Returns the resolved layout direction for this view.
LAYOUT_DIRECTION_RTL
if the layout direction is RTL or returns
LAYOUT_DIRECTION_LTR
if the layout direction is not RTL.
For compatibility, this will return LAYOUT_DIRECTION_LTR
if API version
is lower than JELLY_BEAN_MR1
.Get the LayoutParams associated with this view. All views should have
layout parameters. These supply parameters to the parent of this
view specifying how it should be arranged. There are many subclasses of
ViewGroup.LayoutParams, and these correspond to the different subclasses
of ViewGroup that are responsible for arranging their children.
This method may return null if this View is not attached to a parent
ViewGroup or setLayoutParams(android.view.ViewGroup.LayoutParams)
was not invoked successfully. When a View is attached to a parent
ViewGroup, this method must not return null.
Left position of this view relative to its parent.
Computes the coordinates of this view in its window. The argument must be an array of two integers. After the method returns, the array contains the x and y location in that order.
location | an array of two integers in which to hold the coordinates |
---|
Computes the coordinates of this view on the screen. The argument must be an array of two integers. After the method returns, the array contains the x and y location in that order.
location | an array of two integers in which to hold the coordinates |
---|
The transform matrix of this view, which is calculated based on the current rotation, scale, and pivot properties.
Like getMeasuredHeightAndState()
, but only returns the
raw width component (that is the result is masked by
MEASURED_SIZE_MASK
).
Return the full height measurement information for this view as computed
by the most recent call to measure(int, int)
. This result is a bit mask
as defined by MEASURED_SIZE_MASK
and MEASURED_STATE_TOO_SMALL
.
This should be used during measurement and layout calculations only. Use
getHeight()
to see how wide a view is after layout.
Return only the state bits of getMeasuredWidthAndState()
and getMeasuredHeightAndState()
, combined into one integer.
The width component is in the regular bits MEASURED_STATE_MASK
and the height component is at the shifted bits
MEASURED_HEIGHT_STATE_SHIFT
>>MEASURED_STATE_MASK
.
Like getMeasuredWidthAndState()
, but only returns the
raw width component (that is the result is masked by
MEASURED_SIZE_MASK
).
Return the full width measurement information for this view as computed
by the most recent call to measure(int, int)
. This result is a bit mask
as defined by MEASURED_SIZE_MASK
and MEASURED_STATE_TOO_SMALL
.
This should be used during measurement and layout calculations only. Use
getWidth()
to see how wide a view is after layout.
Returns the minimum height of the view.