View
open class View : AccessibilityEventSource, Drawable.Callback, KeyEvent.Callback
kotlin.Any | |
↳ | android.view.View |
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 android.view.ViewGroup
subclass is the base class for layouts, which are invisible containers that hold other Views (or other ViewGroups) and define their layout properties.
Using Views
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:
- Set properties: for example setting the text of a
android.widget.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. - Set focus: The framework will handle moving focus in response to user input. To force focus to a specific view, call #requestFocus.
- Set up listeners: Views allow clients to set listeners that will be notified when something interesting happens to the view. For example, all views will let you set a listener to be notified when the view gains or loses focus. You can register such a listener using
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. - Set visibility: You can hide or show views using
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 android.view.ViewGroup
.
Implementing a Custom View
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 motion event occurs with pointers down on the view. | |
|
Called when a generic motion event occurs. | |
|
Called when a hover 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. |
IDs
Views may have an integer id associated with them. These ids are typically assigned in the layout XML files, and are used to find specific views within the view tree. A common pattern is to:- Define a Button in the layout file and assign it a unique ID.
<Button android:id="@+id/my_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/my_button_text"/>
- From the onCreate method of an Activity, find the Button
Button myButton = 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.
Position
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.)
Size, padding and margins
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 android.view.ViewGroup
and android.view.ViewGroup.MarginLayoutParams
for further information.
Layout
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 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:
- an exact number
- MATCH_PARENT, which means the view wants to be as big as its parent (minus padding)
- WRAP_CONTENT, which means that the view wants to be just big enough to enclose its content (plus padding).
MeasureSpecs are used to push requirements down the tree from parent to child. A MeasureSpec can be in one of three modes:
- UNSPECIFIED: This is used by a parent to determine the desired dimension of a child view. For example, a LinearLayout may call measure() on its child with the height set to UNSPECIFIED and a width of EXACTLY 240 to find out how tall the child view wants to be given a width of 240 pixels.
- EXACTLY: This is used by the parent to impose an exact size on the child. The child must use this size, and guarantee that all of its descendants will fit within this size.
- AT_MOST: This is used by the parent to impose a maximum size on the child. The child must guarantee that it and all of its descendants will fit within this size.
To initiate a layout, call requestLayout
. This method is typically called by a view on itself when it believes that it can no longer fit within its current bounds.
Drawing
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()
.
Event Handling and Threading
The basic cycle of a view is as follows:
- An event comes in and is dispatched to the appropriate view. The view handles the event and notifies any listeners.
- If in the course of processing the event, the view's bounds may need to be changed, the view will call
requestLayout()
. - Similarly, if in the course of processing the event the view's appearance may need to be changed, the view will call
invalidate()
. - If either
requestLayout()
orinvalidate()
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
.
Focus Handling
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()
.
Touch Mode
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 android.app.Activity
s. Call isInTouchMode
to see whether the device is currently in touch mode.
Scrolling
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.
Tags
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.
Tags may be specified with character sequence values in layout XML as either a single tag using the android:tag
attribute or multiple tags using the <tag>
child element:
<View ... android:tag="@string/mytag_value" /> <View ...> <tag android:id="@+id/mytag" android:value="@string/mytag_value" /> </View>
Tags may also be specified with arbitrary objects from code using setTag(java.lang.Object)
or setTag(int,java.lang.Object)
.
Themes
By default, Views are created using the theme of the Context object supplied to their constructor; however, a different theme may be specified by using the android:theme
attribute in layout XML or by passing a ContextThemeWrapper
to the constructor from code.
When the android:theme
attribute is used in XML, the specified theme is applied on top of the inflation context's theme (see LayoutInflater
) and used for the view itself as well as any child elements.
In the following example, both views will be created using the Material dark color scheme; however, because an overlay theme is used which only defines a subset of attributes, the value of android:colorAccent
defined on the inflation context's theme (e.g. the Activity theme) will be preserved.
<LinearLayout ... android:theme="@android:theme/ThemeOverlay.Material.Dark"> <View ...> </LinearLayout>
Properties
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.
Animation
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(android.view.animation.Animation)
or startAnimation(android.view.animation.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.
Security
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 at the touched location. As a result, the view will not receive touches whenever the touch passed through a toast, dialog or other window that appears above the view's window.
For more fine-grained control over security, consider overriding the onFilterTouchEventForSecurity(android.view.MotionEvent)
method to implement your own security policy. See also MotionEvent.FLAG_WINDOW_IS_OBSCURED
.
Summary
Nested classes | |
---|---|
open |
This class represents a delegate that can be registered in a |
open |
Base class for derived classes that want to save and restore their own state in |
open |
Creates an image that the system displays during the drag and drop operation. |
open |
A MeasureSpec encapsulates the layout requirements passed from parent to child. |
abstract |
Listener for applying window insets on a view in a custom way. |
abstract |
Interface definition for a callback to be invoked when this view is attached or detached from its window. |
abstract |
Interface definition for a callback to be invoked when a captured pointer event is being dispatched this view. |
abstract |
Interface definition for a callback to be invoked when a view is clicked. |
abstract |
Interface definition for a callback to be invoked when a view is context clicked. |
abstract |
Interface definition for a callback to be invoked when the context menu for this view is being built. |
abstract |
Interface definition for a listener that's invoked when a drag event is dispatched to this view. |
abstract |
Interface definition for a callback to be invoked when the focus state of a view changed. |
abstract |
Interface definition for a callback to be invoked when a generic motion event is dispatched to this view. |
abstract |
Interface definition for a callback to be invoked when a hover event is dispatched to this view. |
abstract |
Interface definition for a callback to be invoked when a hardware key event is dispatched to this view. |
abstract |
Interface definition for a callback to be invoked when the layout bounds of a view changes due to layout processing. |
abstract |
Interface definition for a callback to be invoked when a view has been clicked and held. |
abstract |
Interface definition for a callback to be invoked when the scroll X or Y positions of a view change. |
abstract |
Interface definition for a callback to be invoked when the status bar changes visibility. |
abstract |
Interface definition for a callback to be invoked when a touch event is dispatched to this view. |
abstract |
Interface definition for a callback to be invoked when a hardware key event hasn't been handled by the view hierarchy. |
XML attributes | |
---|---|
android:accessibilityHeading |
Whether or not this view is a heading for accessibility purposes. |
android:allowClickWhenDisabled |
Whether or not allow clicks on disabled view. |
android:alpha |
alpha property of the view, as a value between 0 (completely transparent) and 1 (completely opaque). |
android:background |
A drawable to use as the background. |
android:clickable |
Defines whether this view reacts to click events. |
android:clipToOutline |
Whether the View's Outline should be used to clip the contents of the View. |
android:contentDescription |
Defines text that briefly describes content of the view. |
android:drawingCacheQuality |
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:fadeScrollbars |
Defines whether to fade out scrollbars when they are not in use. |
android:fadingEdgeLength |
Defines the length of the fading edges. |
android:filterTouchesWhenObscured |
Specifies whether to filter touches when the view's window is obscured by another visible window. |
android:fitsSystemWindows |
Boolean internal attribute to adjust view layout based on system windows such as the status bar. |
android:focusable |
Controls whether a view can take focus. |
android:focusableInTouchMode |
Boolean that controls whether a view can take focus while in touch mode. |
android:focusedByDefault |
Whether this view is a default-focus view. |
android:hapticFeedbackEnabled |
Boolean that controls whether a view should have haptic feedback enabled for events such as long presses. |
android:id |
Supply an identifier name for this view, to later retrieve it with View. |
android:isScrollContainer |
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 |
Controls whether the view's window should keep the screen on while visible. |
android:keyboardNavigationCluster |
Whether this view is a root of a keyboard navigation cluster. |
android:layerType |
Specifies the type of layer backing this view. |
android:layoutDirection |
Defines the direction of layout drawing. |
android:longClickable |
Defines whether this view reacts to long click events. |
android:minHeight |
Defines the minimum height of the view. |
android:minWidth |
Defines the minimum width of the view. |
android:nextClusterForward |
Defines the next keyboard navigation cluster. |
android:nextFocusDown |
Defines the next view to give focus to when the next focus is android. |
android:nextFocusLeft |
Defines the next view to give focus to when the next focus is android. |
android:nextFocusRight |
Defines the next view to give focus to when the next focus is android. |
android:nextFocusUp |
Defines the next view to give focus to when the next focus is android. |
android:onClick |
Name of the method in this View's context to invoke when the view is clicked. |
android:outlineAmbientShadowColor |
Sets the color of the ambient shadow that is drawn when the view has a positive Z or elevation value. |
android:outlineSpotShadowColor |
Sets the color of the spot shadow that is drawn when the view has a positive Z or elevation value. |
android:padding |
Sets the padding, in pixels, of all four edges. |
android:paddingBottom |
Sets the padding, in pixels, of the bottom edge; see android. |
android:paddingEnd |
Sets the padding, in pixels, of the end edge; see android. |
android:paddingHorizontal |
Sets the padding, in pixels, of the left and right edges; see android. |
android:paddingLeft |
Sets the padding, in pixels, of the left edge; see android. |
android:paddingRight |
Sets the padding, in pixels, of the right edge; see android. |
android:paddingStart |
Sets the padding, in pixels, of the start edge; see android. |
android:paddingTop |
Sets the padding, in pixels, of the top edge; see android. |
android:paddingVertical |
Sets the padding, in pixels, of the top and bottom edges; see android. |
android:requiresFadingEdge |
Defines which edges should be faded on scrolling. |
android:rotation |
rotation of the view, in degrees. |
android:rotationX |
rotation of the view around the x axis, in degrees. |
android:rotationY |
rotation of the view around the y axis, in degrees. |
android:saveEnabled |
If false, no state will be saved for this view when it is being frozen. |
android:scaleX |
scale of the view in the x direction. |
android:scaleY |
scale of the view in the y direction. |
android:scrollX |
The initial horizontal scroll offset, in pixels. |
android:scrollY |
The initial vertical scroll offset, in pixels. |
android:scrollbarAlwaysDrawHorizontalTrack |
Defines whether the horizontal scrollbar track should always be drawn. |
android:scrollbarAlwaysDrawVerticalTrack |
Defines whether the vertical scrollbar track should always be drawn. |
android:scrollbarDefaultDelayBeforeFade |
Defines the delay in milliseconds that a scrollbar waits before fade out. |
android:scrollbarFadeDuration |
Defines the delay in milliseconds that a scrollbar takes to fade out. |
android:scrollbarSize |
Sets the width of vertical scrollbars and height of horizontal scrollbars. |
android:scrollbarStyle |
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 |
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 android. |
android:textAlignment |
Defines the alignment of the text. |
android:textDirection |
Defines the direction of the text. |
android:theme |
Specifies a theme override for a view. |
android:transformPivotX |
x location of the pivot point around which the view will rotate and scale. |
android:transformPivotY |
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 |
translation in x of the view. |
android:translationY |
translation in y of the view. |
android:translationZ |
translation in z of the view. |
android:visibility |
Controls the initial visibility of the view. |
Constants | |
---|---|
static Int |
Automatically determine whether the view should only allow interactions from |
static Int |
Allow interactions from all |
static Int |
Only allow interactions from |
static Int |
Live region mode specifying that accessibility services should immediately notify users of changes to this view. |
static Int |
Live region mode specifying that accessibility services should not automatically announce changes to this view. |
static Int |
Live region mode specifying that accessibility services should notify users of changes to this view. |
static Int |
Flag requesting you to add views that are marked as not important for autofill (see |
static String |
Hint indicating that this view can be autofilled with a credit card expiration date. |
static String |
Hint indicating that this view can be autofilled with a credit card expiration day. |
static String |
Hint indicating that this view can be autofilled with a credit card expiration month. |
static String |
Hint indicating that this view can be autofilled with a credit card expiration year. |
static String |
Hint indicating that this view can be autofilled with a credit card number. |
static String |
Hint indicating that this view can be autofilled with a credit card security code. |
static String |
Hint indicating that this view can be autofilled with an email address. |
static String |
Hint indicating that this view can be autofilled with a user's real name. |
static String |
Hint indicating that this view can be autofilled with a password. |
static String |
Hint indicating that this view can be autofilled with a phone number. |
static String |
Hint indicating that this view can be autofilled with a postal address. |
static String |
Hint indicating that this view can be autofilled with a postal code. |
static String |
Hint indicating that this view can be autofilled with a username. |
static Int |
Autofill type for a field that contains a date, which is represented by a long representing the number of milliseconds since the standard base time known as "the epoch", namely January 1, 1970, 00:00:00 GMT (see |
static Int |
Autofill type for a selection list field, which is filled by an |
static Int |
Autofill type for views that cannot be autofilled. |
static Int |
Autofill type for a text field, which is filled by a |
static Int |
Autofill type for a togglable field, which is filled by a |
static Int |
Content sensitivity is determined by the framework. |
static Int |
The view doesn't display sensitive content. |
static Int |
The view displays sensitive content. |
static Int |
Flag indicating that the drag was initiated with |
static Int |
Flag indicating that a drag can cross window boundaries. |
static Int |
When this flag is used with |
static Int |
When this flag is used with |
static Int |
Flag indicating that a drag can cross window boundaries (within the same application). |
static Int |
When this flag is used with |
static Int |
When this flag is used with |
static Int |
Flag indicating that this drag will result in the caller activity's task to be hidden for the duration of the drag, which means that the source activity will not receive drag events for the current drag gesture. |
static Int |
Flag indicating that the drag shadow will be opaque. |
static Int |
Flag indicating that an unhandled drag should be delegated to the system to be started if no visible window wishes to handle the drop. |
static Int |
Enables automatic quality mode for the drawing cache. |
static Int |
Enables high quality mode for the drawing cache. |
static Int |
Enables low quality mode for the drawing cache. |
static Int |
Find find views that contain the specified content description. |
static Int |
Find views that render the specified text. |
static Int |
This view wants keystrokes. |
static Int |
View flag indicating whether |
static Int |
View flag indicating whether |
static Int |
This view determines focusability automatically. |
static Int |
Use with |
static Int |
Use with |
static Int |
Use with |
static Int |
Use with |
static Int |
Use with |
static Int |
Use with |
static Int |
This view is invisible, and it doesn't take any space for layout purposes. |
static Int |
View flag indicating whether this view should have haptic feedback enabled for events such as long presses. |
static Int |
Automatically determine whether a view is important for accessibility. |
static Int |
The view is not important for accessibility. |
static Int |
The view is not important for accessibility, nor are any of its descendant views. |
static Int |
The view is important for accessibility. |
static Int |
Automatically determine whether a view is important for autofill. |
static Int |
The view is not important for autofill, but its children (if any) will be traversed. |
static Int |
The view is not important for autofill, and its children (if any) will not be traversed. |
static Int |
The view is important for autofill, and its children (if any) will be traversed. |
static Int |
The view is important for autofill, but its children (if any) will not be traversed. |
static Int |
Automatically determine whether a view is important for content capture. |
static Int |
The view is not important for content capture, but its children (if any) will be traversed. |
static Int |
The view is not important for content capture, and its children (if any) will not be traversed. |
static Int |
The view is important for content capture, and its children (if any) will be traversed. |
static Int |
The view is important for content capture, but its children (if any) will not be traversed. |
static Int |
This view is invisible, but it still takes up space for layout purposes. |
static Int |
View flag indicating that the screen should remain on while the window containing this view is visible to the user. |
static Int |
Indicates that the view has a hardware layer. |
static Int |
Indicates that the view does not have a layer. |
static Int |
Indicates that the view has a software layer. |
static Int |
Horizontal layout direction of this view is inherited from its parent. |
static Int |
Horizontal layout direction of this view is from deduced from the default language script for the locale. |
static Int |
Horizontal layout direction of this view is from Left to Right. |
static Int |
Horizontal layout direction of this view is from Right to Left. |
static Int |
Bit shift of |
static Int |
Bits of |
static Int |
Bits of |
static Int |
Bit of |
static Int |
This view does not want keystrokes. |
static Int |
Used to mark a View that has no ID. |
static Int |
Always allow a user to over-scroll this view, provided it is a view that can scroll. |
static Int |
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. |
static Int |
Never allow a user to over-scroll this view. |
static Float | |
static Float | |
static Float | |
static Float | |
static Float | |
static Int |
Indicates that the screen has changed state and is now off. |
static Int |
Indicates that the screen has changed state and is now on. |
static Int |
The scrollbar style to display the scrollbars inside the padded area, increasing the padding of the view. |
static Int |
The scrollbar style to display the scrollbars inside the content area, without increasing the padding. |
static Int |
The scrollbar style to display the scrollbars at the edge of the view, increasing the padding of the view. |
static Int |
The scrollbar style to display the scrollbars at the edge of the view, without increasing the padding. |
static Int |
Position the scroll bar at the default position as determined by the system. |
static Int |
Position the scroll bar along the left edge. |
static Int |
Position the scroll bar along the right edge. |
static Int |
Indicates scrolling along the horizontal axis. |
static Int |
Indicates no axis of view scrolling. |
static Int |
Indicates scrolling along the vertical axis. |
static Int |
The content of this view will be considered for scroll capture if scrolling is possible. |
static Int |
Explicitly exclude this view as a potential scroll capture target. |
static Int |
Explicitly exclude all children of this view as potential scroll capture targets. |
static Int |
Explicitly include this view as a potential scroll capture target. |
static Int |
Scroll indicator direction for the bottom edge of the view. |
static Int |
Scroll indicator direction for the ending edge of the view. |
static Int |
Scroll indicator direction for the left edge of the view. |
static Int |
Scroll indicator direction for the right edge of the view. |
static Int |
Scroll indicator direction for the starting edge of the view. |
static Int |
Scroll indicator direction for the top edge of the view. |
static Int |
View flag indicating whether this view should have sound effects enabled for events such as clicking and touching. |
static Int | |
static Int | |
static Int |
Flag for |
static Int |
Flag for |
static Int |
Flag for |
static Int |
Flag for |
static Int |
Flag for |
static Int |
Flag for |
static Int |
Flag for |
static Int |
Flag for |
static Int |
Flag for |
static Int |
Flag for |
static Int |
Special constant for |
static Int |
Flags that can impact the layout in relation to system UI. |
static Int |
Center the paragraph, e. |
static Int |
Default for the root view. |
static Int |
Default text alignment. |
static Int |
Align to the end of the paragraph, e. |
static Int |
Align to the start of the paragraph, e. |
static Int |
Align to the end of the view, which is ALIGN_RIGHT if the view's resolved layoutDirection is LTR, and ALIGN_LEFT otherwise. |
static Int |
Align to the start of the view, which is ALIGN_LEFT if the view's resolved layoutDirection is LTR, and ALIGN_RIGHT otherwise. |
static Int |
Text direction is using "any-RTL" algorithm. |
static Int |
Text direction is using "first strong algorithm". |
static Int |
Text direction is using "first strong algorithm". |
static Int |
Text direction is using "first strong algorithm". |
static Int |
Text direction is inherited through |
static Int |
Text direction is coming from the system Locale. |
static Int |
Text direction is forced to LTR. |
static Int |
Text direction is forced to RTL. |
static String |
The logging tag used by this class with android. |
static Int |
This view is visible. |
Public constructors | |
---|---|
Simple constructor to use when creating a view from code. |
|
View(context: Context!, attrs: AttributeSet?) Constructor that is called when inflating a view from XML. |
|
View(context: Context!, attrs: AttributeSet?, defStyleAttr: Int) Perform inflation from XML and apply a class-specific base style from a theme attribute. |
|
View(context: Context!, attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int) Perform inflation from XML and apply a class-specific base style from a theme attribute or style resource. |
Public methods | |
---|---|
open Unit |
addChildrenForAccessibility(outChildren: ArrayList<View!>!) Adds the children of this View relevant for accessibility to the given list as output. |
open Unit |
addExtraDataToAccessibilityNodeInfo(info: AccessibilityNodeInfo, extraDataKey: String, arguments: Bundle?) Adds extra data to an |
open Unit |
addFocusables(views: ArrayList<View!>!, direction: Int) Add any focusable views that are descendants of this view (possibly including this view if it is focusable itself) to views. |
open Unit |
addFocusables(views: ArrayList<View!>!, direction: Int, focusableMode: Int) Adds any focusable views that are descendants of this view (possibly including this view if it is focusable itself) to views. |
open Unit |
Adds any keyboard navigation cluster roots that are descendants of this view (possibly including this view if it is a cluster root itself) to views. |
open Unit |
Add a listener for attach state changes. |
open Unit |
addOnLayoutChangeListener(listener: View.OnLayoutChangeListener!) Add a listener that will be called when the bounds of the view change due to layout processing. |
open Unit |
Adds a listener which will receive unhandled |
open Unit |
addTouchables(views: ArrayList<View!>!) Add any touchable views that are descendants of this view (possibly including this view if it is touchable itself) to views. |
open ViewPropertyAnimator! |
animate() This method returns a ViewPropertyAnimator object, which can be used to animate specific properties on this View. |
open Unit |
announceForAccessibility(text: CharSequence!) Convenience method for sending a |
open Unit |
autofill(values: SparseArray<AutofillValue!>) Automatically fills the content of the virtual children within this view. |
open Unit |
autofill(value: AutofillValue!) Automatically fills the content of this view with the |
open Unit |
Change the view's z order in the tree, so it's on top of other sibling views. |
open Unit |
Calling this method is equivalent to calling |
open Unit |
buildDrawingCache(autoScale: Boolean) Forces the drawing cache to be built if the drawing cache is invalid. |
open Unit |
Forces this view's layer to be created and this view to be rendered into its layer. |
open Boolean |
Directly call any attached OnClickListener. |
open Boolean |
Check if layout direction resolution can be done. |
open Boolean |
Check if text alignment resolution can be done. |
open Boolean |
Check if text direction resolution can be done. |
open Boolean |
canScrollHorizontally(direction: Int) Check if this view can be scrolled horizontally in a certain direction. |
open Boolean |
canScrollVertically(direction: Int) Check if this view can be scrolled vertically in a certain direction. |
Unit |
Cancels an ongoing drag and drop operation. |
open Unit |
Cancels a pending long press. |
Unit |
Cancel any deferred high-level input events that were previously posted to the event queue. |
open Boolean |
checkInputConnectionProxy(view: View!) Called by the |
open Unit |
Cancels any animations for this view. |
open Unit |
Called when this view wants to give up focus. |
open Unit |
Clears the request and callback previously set through |
open Unit |
Clear the |
open static Int |
combineMeasuredStates(curState: Int, newState: Int) Merge two states as returned by |
open Unit |
Called by a parent to request that a child update its values for mScrollX and mScrollY if necessary. |
open WindowInsets! |
computeSystemWindowInsets(in: WindowInsets!, outLocalInsets: Rect!) Compute insets that should be consumed by this view and the ones that should propagate to those under it. |
open AccessibilityNodeInfo! |
Returns an |
open Unit |
Show the context menu for this view. |
open Unit |
Frees the resources used by the drawing cache. |
open WindowInsets! |
dispatchApplyWindowInsets(insets: WindowInsets!) Request to apply the given window insets to this view or another view in its subtree. |
open Boolean |
dispatchCapturedPointerEvent(event: MotionEvent!) Pass a captured pointer event down to the focused view. |
open Unit |
dispatchConfigurationChanged(newConfig: Configuration!) Dispatch a notification about a resource configuration change down the view hierarchy. |
open Unit |
dispatchCreateViewTranslationRequest(viewIds: MutableMap<AutofillId!, LongArray!>, supportedFormats: IntArray, capability: TranslationCapability, requests: MutableList<ViewTranslationRequest!>) Dispatch to collect the |
open Unit |
dispatchDisplayHint(hint: Int) Dispatch a hint about whether this view is displayed. |
open Boolean |
dispatchDragEvent(event: DragEvent!) Detects if this View is enabled and has a drag event listener. |
open Unit |
dispatchDrawableHotspotChanged(x: Float, y: Float) Dispatches drawableHotspotChanged to all of this View's children. |
open Unit |
Dispatch |
open Boolean |
dispatchGenericMotionEvent(event: MotionEvent!) Dispatch a generic motion event. |
open Boolean |
dispatchKeyEvent(event: KeyEvent!) Dispatch a key event to the next view on the focus path. |
open Boolean |
dispatchKeyEventPreIme(event: KeyEvent!) Dispatch a key event before it is processed by any input method associated with the view hierarchy. |
open Boolean |
dispatchKeyShortcutEvent(event: KeyEvent!) Dispatches a key shortcut event. |
open Boolean |
dispatchNestedFling(velocityX: Float, velocityY: Float, consumed: Boolean) Dispatch a fling to a nested scrolling parent. |
open Boolean |
dispatchNestedPreFling(velocityX: Float, velocityY: Float) Dispatch a fling to a nested scrolling parent before it is processed by this view. |
open Boolean |
dispatchNestedPrePerformAccessibilityAction(action: Int, arguments: Bundle?) Report an accessibility action to this view's parents for delegated processing. |
open Boolean |
dispatchNestedPreScroll(dx: Int, dy: Int, consumed: IntArray?, offsetInWindow: IntArray?) Dispatch one step of a nested scroll in progress before this view consumes any portion of it. |
open Boolean |
dispatchNestedScroll(dxConsumed: Int, dyConsumed: Int, dxUnconsumed: Int, dyUnconsumed: Int, offsetInWindow: IntArray?) Dispatch one step of a nested scroll in progress. |
open Unit |
dispatchPointerCaptureChanged(hasCapture: Boolean) |
open Boolean |
Dispatches an |
open Unit |
dispatchProvideAutofillStructure(structure: ViewStructure, flags: Int) Dispatches creation of a |
open Unit |
dispatchProvideStructure(structure: ViewStructure!) Dispatch creation of |
open Unit |
dispatchScrollCaptureSearch(localVisibleRect: Rect, windowOffset: Point, targets: Consumer<ScrollCaptureTarget!>) Dispatch a scroll capture search request down the view hierarchy. |
open Unit |
Dispatch |
open Unit |
dispatchSystemUiVisibilityChanged(visibility: Int) Dispatch callbacks to |
open Boolean |
dispatchTouchEvent(event: MotionEvent!) Pass the touch screen motion event down to the target view, or this view if it is the target. |
open Boolean |
dispatchTrackballEvent(event: MotionEvent!) Pass a trackball motion event down to the focused view. |
open Boolean |
dispatchUnhandledMove(focused: View!, direction: Int) This method is the last chance for the focused view and its ancestors to respond to an arrow key. |
open Unit |
dispatchWindowFocusChanged(hasFocus: Boolean) Called when the window containing this view gains or loses window focus. |
open Unit |
Dispatches |
open Unit |
Dispatches |
open WindowInsets |
dispatchWindowInsetsAnimationProgress(insets: WindowInsets, runningAnimations: MutableList<WindowInsetsAnimation!>) Dispatches |
open WindowInsetsAnimation.Bounds |
dispatchWindowInsetsAnimationStart(animation: WindowInsetsAnimation, bounds: WindowInsetsAnimation.Bounds) Dispatches |
open Unit |
dispatchWindowSystemUiVisiblityChanged(visible: Int) Dispatch callbacks to |
open Unit |
dispatchWindowVisibilityChanged(visibility: Int) Dispatch a window visibility change down the view hierarchy. |
open Unit |
Manually render this view (and all of its children) to the given Canvas. |
open Unit |
drawableHotspotChanged(x: Float, y: Float) This function is called whenever the view hotspot changes and needs to be propagated to drawables or child views managed by the view. |
open View! |
Find the view in the hierarchy rooted at this view that currently has focus. |
OnBackInvokedDispatcher? |
Walk up the View hierarchy to find the nearest |
T |
findViewById(id: Int) Finds the first descendant view with the given ID, the view itself if the ID matches |
T |
findViewWithTag(tag: Any!) Look for a child view with the given tag. |
open Unit |
findViewsWithText(outViews: ArrayList<View!>!, searched: CharSequence!, flags: Int) Finds the Views that contain given text. |
open View! |
focusSearch(direction: Int) Find the nearest view in the specified direction that can take focus. |
open Unit |
forceHasOverlappingRendering(hasOverlappingRendering: Boolean) Sets the behavior for overlapping rendering for this view (see |
open Unit |
Forces this view to be laid out during the next layout pass. |
open Boolean |
gatherTransparentRegion(region: Region?) This is used by the ViewRoot to perform an optimization when the view hierarchy contains one or several SurfaceView. |
open Unit |
generateDisplayHash(hashAlgorithm: String, bounds: Rect?, executor: Executor, callback: DisplayHashResultCallback) Called to generate a |
open static Int |
Generate a value suitable for use in |
open CharSequence! |
Return the class name of this object to be used for accessibility purposes. |
open View.AccessibilityDelegate! |
Returns the delegate for implementing accessibility support via composition. |
open Int |
Gets the live region mode for this View. |
open AccessibilityNodeProvider! |
Gets the provider for managing a virtual view hierarchy rooted at this View and reported to |
open CharSequence? |
Get the title of the pane for purposes of accessibility. |
open Int |
Gets the id of a view after which this one is visited in accessibility traversal. |
open Int |
Gets the id of a view before which this one is visited in accessibility traversal. |
open String? |
Returns the allowed package for delegate editor views for which this view may act as a handwriting delegator, as set by |
open String? |
Returns the allowed package for views which may act as a handwriting delegator for this delegate editor view, as set by |
open Float |
getAlpha() The opacity of the view. |
open Animation! |
Get the animation currently associated with this view. |
open Matrix? |
Return the current transformation matrix of the view. |
open IBinder! |
Retrieve a unique token identifying the top-level "real" window of the window that this view is attached to. |
open IntArray |
getAttributeResolutionStack(attribute: Int) Returns the ordered list of resource ID that are considered when resolving attribute values for this |
open MutableMap<Int!, Int!> |
Returns the mapping of attribute resource ID to source resource ID where the attribute value was set. |
open Array<String!>? |
Gets the hints that help an |
AutofillId! |
Gets the unique, logical identifier of this view in the activity, for autofill purposes. |
open Int |
Describes the autofill type of this view, so an |
open AutofillValue? |
Gets the |
open Drawable! |
Gets the background drawable |
open BlendMode? |
Return the blending mode used to apply the tint to the background drawable, if specified. |
open ColorStateList? |
Return the tint applied to the background drawable, if specified. |
open PorterDuff.Mode? |
Return the blending mode used to apply the tint to the background drawable, if specified. |
open Int |
Return the offset of the widget's text baseline from the widget's top boundary. |
Int |
Bottom position of this view relative to its parent. |
open Float |
Gets the distance along the Z axis from the camera to this view. |
open Rect! |
Returns a copy of the current |
open Boolean |
getClipBounds(outRect: Rect!) Populates an output rectangle with the clip bounds of the view, returning |
Boolean |
Returns whether the Outline should be used to clip the contents of the View. |
ContentCaptureSession? |
Gets the session used to notify content capture events. |
open CharSequence! |
Returns the |
Int |
Gets content sensitivity mode to determine whether this view displays sensitive content. |
Context! |
Returns the context the view is running in, through which it can access the current theme, resources, etc. |
Boolean |
Returns whether this View should use a default focus highlight when it gets focused but doesn't have |
open static Int |
getDefaultSize(size: Int, measureSpec: Int) Utility to return a default size. |
open Display! |
Gets the logical display to which the view's window has been attached. |
IntArray! |
Return an array of resource IDs of the drawable states representing the current state of the view. |
open Bitmap! |
Calling this method is equivalent to calling |
open Bitmap! |
getDrawingCache(autoScale: Boolean) Returns the bitmap in which this view drawing is cached. |
open Int | |
open Int |
Returns the quality of the drawing cache. |
open Unit |
getDrawingRect(outRect: Rect!) Return the visible drawing bounds of your view. |
open Long |
Return the time at which the drawing of the view hierarchy started. |
open Float |
The base elevation of this view relative to its parent, in pixels. |
open Int |
Returns the resource ID for the style specified using |
open Boolean |
Gets whether the framework should discard touches when the view's window is obscured by another visible window at the touched location. |
open Boolean |
Check for state of |
open Int |
Returns the focusable setting for this view. |
open ArrayList<View!>! |
getFocusables(direction: Int) Find and return all focusable views that are descendants of this view, possibly including this view if it is focusable itself. |
open Unit |
getFocusedRect(r: Rect!) 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. |
open Drawable! |
Returns the drawable used as the foreground of this View. |
open Int |
Describes how the foreground is positioned. |
open BlendMode? |
Return the blending mode used to apply the tint to the foreground drawable, if specified. |
open ColorStateList? |
Return the tint applied to the foreground drawable, if specified. |
open PorterDuff.Mode? |
Return the blending mode used to apply the tint to the foreground drawable, if specified. |
open Float |
Get the current velocity of the View. |
Boolean |
getGlobalVisibleRect(r: Rect!) Sets |
open Boolean |
getGlobalVisibleRect(r: Rect!, globalOffset: Point!) Sets |
open Handler! | |
open Float |
Return the amount of offset applied to the bottom edge of this view's handwriting bounds, in the unit of pixel. |
open Float |
Return the amount of offset applied to the left edge of this view's handwriting bounds, in the unit of pixel. |
open Float |
Return the amount of offset applied to the right edge of this view's handwriting bounds, in the unit of pixel. |
open Float |
Return the amount of offset applied to the top edge of this view's handwriting bounds, in the unit of pixel. |
open Int |
Returns flags configuring the handwriting delegation behavior for this delegate editor view, as set by |
open Runnable? |
Returns the callback set by |
Boolean |
Returns the value for overlapping rendering that is used internally. |
Int |
Return the height of your view. |
open Unit |
getHitRect(outRect: Rect!) Hit rectangle in parent's coordinates |
open Int |
Returns the size of the horizontal faded edges used to indicate that more content in this view is visible. |
open Drawable? |
Returns the currently configured Drawable for the thumb of the horizontal scroll bar if it exists, null otherwise. |
open Drawable? |
Returns the currently configured Drawable for the track of the horizontal scroll bar if it exists, null otherwise. |
open Int |
getId() Returns this view's identifier. |
open Int |
Gets the mode for determining whether this View is important for accessibility. |
open Int |
Gets the mode for determining whether this view is important for autofill. |
open Int |
Gets the mode for determining whether this view is important for content capture. |
open Boolean |
Returns whether the screen should remain on, corresponding to the current value of |
open KeyEvent.DispatcherState! |
Return the global |
open Int |
Gets the id of a view for which this view serves as a label for accessibility purposes. |
open Int |
Indicates what type of layer is currently associated with this view. |
open Int |
Returns the resolved layout direction for this view. |
open ViewGroup.LayoutParams! |
Get the LayoutParams associated with this view. |
Int |
getLeft() Left position of this view relative to its parent. |
Boolean |
getLocalVisibleRect(r: Rect!) Sets |
open Unit |
getLocationInSurface(location: IntArray) Gets the coordinates of this view in the coordinate space of the |
open Unit |
getLocationInWindow(outLocation: IntArray!) Gets the coordinates of this view in the coordinate space of the window that contains the view, irrespective of system decorations. |
open Unit |
getLocationOnScreen(outLocation: IntArray!) Gets the coordinates of this view in the coordinate space of the device screen, irrespective of system decorations and whether the system is in multi-window mode. |
open Matrix! |
The transform matrix of this view, which is calculated based on the current rotation, scale, and pivot properties. |
Int |
Like |
Int |
Return the full height measurement information for this view as computed by the most recent call to |
Int |
Return only the state bits of |
Int |
Like |
Int |
Return the full width measurement information for this view as computed by the most recent call to |
open Int |
Returns the minimum height of the view. |
open Int |
Returns the minimum width of the view. |
open Int |
Gets the id of the root of the next keyboard navigation cluster. |
open Int |
Gets the id of the view to use when the next focus is |
open Int |
Gets the id of the view to use when the next focus is |
open Int |
Gets the id of the view to use when the next focus is |
open Int |
Gets the id of the view to use when the next focus is |
open Int |
Gets the id of the view to use when the next focus is |
open View.OnFocusChangeListener! |
Returns the focus-change callback registered for this view. |
open Int | |
open ViewOutlineProvider! |
Returns the current |
open Int | |
open Int |
Returns the over-scroll mode for this view. |
open ViewOverlay! |
Returns the overlay for this view, creating it if it does not yet exist. |
open Int |
Returns the bottom padding of this view. |
open Int |
Returns the end padding of this view depending on its resolved layout direction. |
open Int |
Returns the left padding of this view. |
open Int |
Returns the right padding of this view. |
open Int |
Returns the start padding of this view depending on its resolved layout direction. |
open Int |
Returns the top padding of this view. |
ViewParent! |
Gets the parent of this view. |
open ViewParent! |
Gets the parent for accessibility purposes. |
OutcomeReceiver<GetCredentialResponse!, GetCredentialException!>? |
Returns the callback that has previously been set up on this view through the |
GetCredentialRequest? |
Returns the |
open Float |
The x location of the point around which the view is |
open Float |
The y location of the point around which the view is |
open PointerIcon! |
Gets the mouse pointer icon for the current view. |
MutableList<Rect!> | |
open Array<String!>? |
Returns the MIME types accepted by |
open Float |
Get the current preferred frame rate of the View. |
open Resources! |
Returns the resources associated with this view. |
Boolean |
Returns this view's preference for reveal behavior when it gains focus. |
Int |
getRight() Right position of this view relative to its parent. |
open AttachedSurfaceControl? |
The AttachedSurfaceControl itself is not a View, it is just the interface to the windowing-system object that contains the entire view hierarchy. |
open View! |
Finds the topmost view in the current view hierarchy. |
open WindowInsets! |
Provide original WindowInsets that are dispatched to the view hierarchy. |
open Float |
The degrees that the view is rotated around the pivot point. |
open Float |
The degrees that the view is rotated around the horizontal axis through the pivot point. |
open Float |
The degrees that the view is rotated around the vertical axis through the pivot point. |
open Float |
The amount that the view is scaled in x around the pivot point, as a proportion of the view's unscaled width. |
open Float |
The amount that the view is scaled in y around the pivot point, as a proportion of the view's unscaled height. |
open Int |
Returns the delay before scrollbars fade. |
open Int |
Returns the scrollbar fade duration. |
open Int |
Returns the scrollbar size. |
open Int |
Returns the current scrollbar style. |
open Int |
Returns the current scroll capture hint for this view. |
open Int |
Returns a bitmask representing the enabled scroll indicators. |
Int |
Return the scrolled left position of this view. |
Int |
Return the scrolled top position of this view. |
open Int |
Override this if your view is known to always be drawn on top of a solid color background, and needs to draw fading edges. |
open Int |
A |
CharSequence? |
Returns the |
open StateListAnimator! |
Returns the current StateListAnimator if exists. |
open CharSequence? |
Returns the |
open MutableList<Rect!> |
Retrieve the list of areas within this view's post-layout coordinate space where the system should not intercept touch or other pointing device gestures. |
open Int |
Returns the last |
open Any! |
getTag() Returns this view's tag. |
open Any! |
Returns the tag associated with this view and the specified key. |
open Int |
Return the resolved text alignment. |
open Int |
Return the resolved text direction. |
open CharSequence? |
Returns the view's tooltip text. |
Int |
getTop() Top position of this view relative to its parent. |
open TouchDelegate! |
Gets the TouchDelegate for this View. |
open ArrayList<View!>! |
Find and return all touchable views that are descendants of this view, possibly including this view if it is touchable itself. |
open Float |
This property is intended only for use by the Fade transition, which animates it to produce a visual translucency that does not side-effect (or get affected by) the real alpha property. |
open String! |
Returns the name of the View to be used to identify Views in Transitions. |
open Float |
The horizontal location of this view relative to its |
open Float |
The vertical location of this view relative to its |
open Float |
The depth location of this view relative to its |
open Long |
Get the identifier used for this view by the drawing system. |
open Int |
Returns the size of the vertical faded edges used to indicate that more content in this view is visible. |
open Int | |
open Drawable? |
Returns the currently configured Drawable for the thumb of the vertical scroll bar if it exists, null otherwise. |
open Drawable? |
Returns the currently configured Drawable for the track of the vertical scroll bar if it exists, null otherwise. |
open Int |
Returns the width of the vertical scrollbar. |
open ViewTranslationResponse? |
Returns the |
open ViewTreeObserver! |
Returns the ViewTreeObserver for this view's hierarchy. |
open Int |
Returns the visibility status for this view. |
Int |
getWidth() Return the width of your view. |
open WindowId! |
Retrieve the |
open WindowInsetsController? |
Retrieves the single |
open Int |
Returns the current system UI visibility that is currently set for the entire window. |
open IBinder! |
Retrieve a unique token identifying the window this view is attached to. |
open Int |
Returns the current visibility of the window this view is attached to (either |
open Unit |
getWindowVisibleDisplayFrame(outRect: Rect!) Retrieve the overall visible display size in which the window this view is attached to has been positioned in. |
open Float |
getX() The visual x position of this view, in pixels. |
open Float |
getY() The visual y position of this view, in pixels. |
open Float |
getZ() The visual z position of this view, in pixels. |
open Boolean |
Returns true if this view is focusable or if it contains a reachable View for which |
open Boolean |
hasFocus() Returns true if this view has focus itself, or is the ancestor of the view that has focus. |
open Boolean |
Returns true if this view is focusable or if it contains a reachable View for which |
open Boolean |
Returns true if this view has a nested scrolling parent. |
open Boolean |
Return whether this view has an attached OnClickListener. |
open Boolean |
Return whether this view has an attached OnLongClickListener. |
open Boolean |
Returns whether this View has content which overlaps. |
open Boolean |
Checks pointer capture status. |
open Boolean |
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. |
open Boolean |
Returns true if this view is in a window that currently has window focus. |
open static View! |
Inflate a view from an XML resource. |
open Unit |
Invalidate the whole view. |
open Unit |
invalidate(dirty: Rect!) Mark the area defined by dirty as needing to be drawn. |
open Unit |
invalidate(l: Int, t: Int, r: Int, b: Int) Mark the area defined by the rect (l,t,r,b) as needing to be drawn. |
open Unit |
invalidateDrawable(drawable: Drawable) Invalidates the specified Drawable. |
open Unit |
Called to rebuild this View's Outline from its |
open Boolean |
Whether this view should restrict accessibility service access only to services that have the |
open Boolean |
Returns whether this View is accessibility focused. |
open Boolean |
Gets whether this view is a heading for accessibility purposes. |
open Boolean |
Indicates the activation state of this view. |
open Boolean |
Returns true if this view is currently attached to a window. |
open Boolean |
Return whether the View allows automatic handwriting initiation. |
open Boolean |
Indicates whether this view reacts to click events or not. |
Boolean |
Returns whether this view displays sensitive content, based on the value explicitly set by |
open Boolean |
Indicates whether this view reacts to context clicks or not. |
open Boolean |
Gets the mode for determining whether this view is a credential. |
open Boolean |
isDirty() True if this view has changed since the last time being drawn. |
open Boolean |
Indicates whether the drawing cache is enabled for this view. |
open Boolean |
Indicates whether this duplicates its drawable state from its parent. |
open Boolean |
Returns the enabled status for this view. |
Boolean |
Returns whether this View is currently able to take focus. |
Boolean |
When a view is focusable, it may not want to take focus when in touch mode. |
open Boolean |
Returns true if this view has focus |
Boolean |
Returns whether this View should receive focus when the focus is restored for the view hierarchy containing this view. |
open Boolean | |
open Boolean |
Returns whether this view has been set as a handwriting delegate by |
open Boolean | |
open Boolean |
Indicates whether this view is attached to a hardware accelerated window or not. |
open Boolean |
Indicate whether the horizontal edges are faded when the view is scrolled horizontally. |
open Boolean |
Indicate whether the horizontal scrollbar should be drawn or not. |
open Boolean |
Returns true if the view is currently hovered. |
open Boolean |
Computes whether this view should be exposed for accessibility. |
Boolean |
Hints the Android System whether the |
Boolean |
Hints the Android System whether this view is considered important for content capture, based on the value explicitly set by |
open Boolean |
Indicates whether this View is currently in edit mode. |
open Boolean |
Returns whether the view hierarchy is currently undergoing a layout pass. |
open Boolean |
Returns the touch mode state associated with this view. |
Boolean |
Returns whether this View is a root of a keyboard navigation cluster. |
open Boolean |
Returns true if this view has been through at least one layout since it was last attached to or detached from a window. |
open Boolean | |
open Boolean |
Indicates whether or not this view's layout will be requested during the next hierarchy layout pass. |
open Boolean |
Indicates whether this view reacts to long click events or not. |
open Boolean |
Returns true if nested scrolling is enabled for this view. |
open Boolean |
isOpaque() Indicates whether this View is opaque. |
open Boolean |
Return if the padding has been set through relative values |
open Boolean |
Returns whether or not a pivot has been set by a call to |
Boolean |
Retrieve the preference for this view to be kept clear. |
open Boolean |
Indicates whether the view is currently in pressed state. |
open Boolean |
Indicates whether this view will save its state (that is, whether its |
open Boolean |
Indicates whether the entire hierarchy under this view will save its state when a state saving traversal occurs from its parent. |
open Boolean |
Returns whether the view should be treated as a focusable unit by screen reader accessibility tools. |
open Boolean |
Indicates whether this view is one of the set of scrollable containers in its window. |
open Boolean |
Returns true if scrollbars will fade when this view is not scrolling |
open Boolean |
Indicates the selection state of this view. |
Boolean |
Returns |
open Boolean |
isShown() Returns the visibility of this view and all of its ancestors |
open Boolean | |
Boolean |
Tells whether the |
open Boolean | |
open Boolean | |
open Boolean |
Indicate whether the vertical edges are faded when the view is scrolled horizontally. |
open Boolean |
Indicate whether the vertical scrollbar should be drawn or not. |
open Boolean |
isVisibleToUserForAutofill(virtualId: Int) Computes whether this virtual autofill view is visible to the user. |
open Unit |
Call |
open View! |
Find the nearest keyboard navigation cluster in the specified direction. |
open Unit |
Assign a size and position to a view and all of its descendants |
Unit |
This is called to find out how big a view should be. |
open Unit |
offsetLeftAndRight(offset: Int) Offset this view's horizontal location by the specified amount of pixels. |
open Unit |
offsetTopAndBottom(offset: Int) Offset this view's vertical location by the specified number of pixels. |
open WindowInsets! |
onApplyWindowInsets(insets: WindowInsets!) Called when the view should apply |
open Unit |
Called as the result of a call to |
open Boolean |
onCapturedPointerEvent(event: MotionEvent!) Implement this method to handle captured pointer events |
open Boolean |
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. |
open InputConnection! |
onCreateInputConnection(outAttrs: EditorInfo!) Create a new InputConnection for an InputMethod to interact with the view. |
open Unit |
onCreateViewTranslationRequest(supportedFormats: IntArray, requestsCollector: Consumer<ViewTranslationRequest!>) Collects a |
open Unit |
onCreateVirtualViewTranslationRequests(virtualIds: LongArray, supportedFormats: IntArray, requestsCollector: Consumer<ViewTranslationRequest!>) Collects |
open Boolean |
onDragEvent(event: DragEvent!) Handles drag events sent by the system following a call to |
open Unit |
onDrawForeground(canvas: Canvas) Draw any foreground content for this view. |
open Boolean |
onFilterTouchEventForSecurity(event: MotionEvent!) Filter the touch event to apply security policies. |
open Unit |
Called after |
open Boolean |
onGenericMotionEvent(event: MotionEvent!) Implement this method to handle generic motion events. |
open Unit |
onHoverChanged(hovered: Boolean) Implement this method to handle hover state changes. |
open Boolean |
onHoverEvent(event: MotionEvent!) Implement this method to handle hover events. |
open Unit |
Initializes an |
open Unit |
Initializes an |
open Boolean |
Default implementation of |
open Boolean |
onKeyLongPress(keyCode: Int, event: KeyEvent!) Default implementation of |
open Boolean |
onKeyMultiple(keyCode: Int, repeatCount: Int, event: KeyEvent!) Default implementation of |
open Boolean |
onKeyPreIme(keyCode: Int, event: KeyEvent!) Handle a key event before it is processed by any input method associated with the view hierarchy. |
open Boolean |
onKeyShortcut(keyCode: Int, event: KeyEvent!) Called on the focused view when a key shortcut event is not handled. |
open Boolean |
Default implementation of |
open Unit |
onPointerCaptureChange(hasCapture: Boolean) Called when the window has just acquired or lost pointer capture. |
open Unit |
Called from |
open Unit |
onProvideAutofillStructure(structure: ViewStructure!, flags: Int) Populates a |
open Unit |
onProvideAutofillVirtualStructure(structure: ViewStructure!, flags: Int) Populates a |
open Unit |
onProvideContentCaptureStructure(structure: ViewStructure, flags: Int) Populates a |
open Unit |
onProvideStructure(structure: ViewStructure!) Called when assist structure is being retrieved from a view as part of |
open Unit |
onProvideVirtualStructure(structure: ViewStructure!) Called when assist structure is being retrieved from a view as part of |
open ContentInfo? |
onReceiveContent(payload: ContentInfo) Implements the default behavior for receiving content for this type of view. |
open PointerIcon! |
onResolvePointerIcon(event: MotionEvent!, pointerIndex: Int) Resolve the pointer icon that should be used for specified pointer in the motion event. |
open Unit |
onRtlPropertiesChanged(layoutDirection: Int) Called when any RTL property (layout direction or text direction or text alignment) has been changed. |
open Unit |
onScreenStateChanged(screenState: Int) This method is called whenever the state of the screen this view is attached to changes. |
open Unit |
onScrollCaptureSearch(localVisibleRect: Rect, windowOffset: Point, targets: Consumer<ScrollCaptureTarget!>) Called when scroll capture is requested, to search for appropriate content to scroll. |
open Unit |
This is called when a container is going to temporarily detach a child, with |
open Boolean |
onTouchEvent(event: MotionEvent!) Implement this method to handle pointer events. |
open Boolean |
onTrackballEvent(event: MotionEvent!) Implement this method to handle trackball motion events. |
open Unit |
onViewTranslationResponse(response: ViewTranslationResponse) Called when the content from |
open Unit |
Called when the content from |
open Unit |
onVisibilityAggregated(isVisible: Boolean) Called when the user-visibility of this View is potentially affected by a change to this view itself, an ancestor view or the window this view is attached to. |
open Unit |
onWindowFocusChanged(hasWindowFocus: Boolean) Called when the window containing this view gains or loses focus. |
open Unit |
onWindowSystemUiVisibilityChanged(visible: Int) Override to find out when the window's requested system UI visibility has changed, that is the value returned by |
open Boolean |
performAccessibilityAction(action: Int, arguments: Bundle?) Performs the specified accessibility action on the view. |
open Boolean |
Call this view's OnClickListener, if it is defined. |
open Boolean |
Call this view's OnContextClickListener, if it is defined. |
open Boolean |
performContextClick(x: Float, y: Float) Call this view's OnContextClickListener, if it is defined. |
open Boolean |
performHapticFeedback(feedbackConstant: Int) BZZZTT!!1! |
open Boolean |
performHapticFeedback(feedbackConstant: Int, flags: Int) BZZZTT!!1! |
open Boolean |
Calls this view's OnLongClickListener, if it is defined. |
open Boolean |
performLongClick(x: Float, y: Float) Calls this view's OnLongClickListener, if it is defined. |
open ContentInfo? |
performReceiveContent(payload: ContentInfo) Receives the given content. |
open Unit |
playSoundEffect(soundConstant: Int) Play a sound effect for this view. |
open Boolean |
Causes the Runnable to be added to the message queue. |
open Boolean |
postDelayed(action: Runnable!, delayMillis: Long) Causes the Runnable to be added to the message queue, to be run after the specified amount of time elapses. |
open Unit |
Cause an invalidate to happen on a subsequent cycle through the event loop. |
open Unit |
postInvalidate(left: Int, top: Int, right: Int, bottom: Int) Cause an invalidate of the specified area to happen on a subsequent cycle through the event loop. |
open Unit |
postInvalidateDelayed(delayMilliseconds: Long) Cause an invalidate to happen on a subsequent cycle through the event loop. |
open Unit |
Cause an invalidate of the specified area to happen on a subsequent cycle through the event loop. |
open Unit |
Cause an invalidate to happen on the next animation time step, typically the next display frame. |
open Unit |
postInvalidateOnAnimation(left: Int, top: Int, right: Int, bottom: Int) Cause an invalidate of the specified area to happen on the next animation time step, typically the next display frame. |
open Unit |
postOnAnimation(action: Runnable!) Causes the Runnable to execute on the next animation time step. |
open Unit |
postOnAnimationDelayed(action: Runnable!, delayMillis: Long) Causes the Runnable to execute on the next animation time step, after the specified amount of time elapses. |
open Unit |
Call this to force a view to update its drawable state. |
open Unit |
Releases the pointer capture. |
open Boolean |
removeCallbacks(action: Runnable!) Removes the specified Runnable from the message queue. |
open Unit |
Remove a listener for attach state changes. |
open Unit |
Remove a listener for layout changes. |
open Unit |
Removes a listener which will receive unhandled |
open Unit |
reportAppJankStats(appJankStats: AppJankStats) Called from apps when they want to report jank stats to the system. |
open Unit |
Ask that a new dispatch of |
open Unit |
Ask that a new dispatch of |
Boolean |
Call this to try to give focus to a specific view or to one of its descendants. |
Boolean |
requestFocus(direction: Int) 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. |
open Boolean |
requestFocus(direction: Int, previouslyFocusedRect: Rect!) 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. |
Boolean |
Call this to try to give focus to a specific view or to one of its descendants. |
open Unit |
Call this when something has changed which has invalidated the layout of this view. |
open Unit |
Requests pointer capture mode. |
open Boolean |
requestRectangleOnScreen(rectangle: Rect!) Request that a rectangle of this view be visible on the screen, scrolling if necessary just enough. |
open Boolean |
requestRectangleOnScreen(rectangle: Rect!, immediate: Boolean) Request that a rectangle of this view be visible on the screen, scrolling if necessary just enough. |
Unit |
requestUnbufferedDispatch(event: MotionEvent!) Request unbuffered dispatch of the given stream of MotionEvents to this View. |
Unit |
requestUnbufferedDispatch(source: Int) Request unbuffered dispatch of the given event source class to this view. |
T |
requireViewById(id: Int) Finds the first descendant view with the given ID, the view itself if the ID matches |
open Unit |
Clears any pivot previously set by a call to |
open static Int |
resolveSize(size: Int, measureSpec: Int) Version of |
open static Int |
resolveSizeAndState(size: Int, measureSpec: Int, childMeasuredState: Int) Utility to reconcile a desired size and state, with constraints imposed by a MeasureSpec. |
open Boolean |
Gives focus to the default-focus view in the view hierarchy that has this view as a root. |
open Unit |
restoreHierarchyState(container: SparseArray<Parcelable!>!) Restore this view hierarchy's frozen state from the given container. |
Unit |
saveAttributeDataForStyleable(context: Context, styleable: IntArray, attrs: AttributeSet?, t: TypedArray, defStyleAttr: Int, defStyleRes: Int) Stores debugging information about attributes. |
open Unit |
saveHierarchyState(container: SparseArray<Parcelable!>!) Store this view hierarchy's frozen state into the given container. |
open Unit |
scheduleDrawable(who: Drawable, what: Runnable, when: Long) Schedules an action on a drawable to occur at a specified time. |
open Unit |
Move the scrolled position of your view. |
open Unit |
Set the scrolled position of your view. |
open Unit |
sendAccessibilityEvent(eventType: Int) Sends an accessibility event of the given type. |
open Unit |
This method behaves exactly as |
open Unit |
setAccessibilityDataSensitive(accessibilityDataSensitive: Int) Specifies whether this view should only allow interactions from |
open Unit |
setAccessibilityDelegate(delegate: View.AccessibilityDelegate?) Sets a delegate for implementing accessibility support via composition (as opposed to inheritance). |
open Unit |
setAccessibilityHeading(isHeading: Boolean) Set if view is a heading for a section of content for accessibility purposes. |
open Unit |
setAccessibilityLiveRegion(mode: Int) Sets the live region mode for this view. |
open Unit |
setAccessibilityPaneTitle(accessibilityPaneTitle: CharSequence?) Visually distinct portion of a window with window-like semantics are considered panes for accessibility purposes. |
open Unit |
setAccessibilityTraversalAfter(afterId: Int) Sets the id of a view that screen readers are requested to visit before this view. |
open Unit |
setAccessibilityTraversalBefore(beforeId: Int) Sets the id of a view that screen readers are requested to visit after this view. |
open Unit |
setActivated(activated: Boolean) Changes the activated state of this view. |
open Unit |
setAllowClickWhenDisabled(clickableWhenDisabled: Boolean) Enables or disables click events for this view when disabled. |
open Unit |
setAllowedHandwritingDelegatePackage(allowedPackageName: String?) Specifies that this view may act as a handwriting initiation delegator for a delegate editor view from the specified package. |
open Unit |
setAllowedHandwritingDelegatorPackage(allowedPackageName: String?) Specifies that a view from the specified package may act as a handwriting delegator for this delegate editor view. |
open Unit |
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. |
open Unit |
setAnimation(animation: Animation!) Sets the next animation to play for this view. |
open Unit |
setAnimationMatrix(matrix: Matrix?) Changes the transformation matrix on the view. |
open Unit |
setAutoHandwritingEnabled(enabled: Boolean) Set whether this view enables automatic handwriting initiation. |
open Unit |
setAutofillHints(vararg autofillHints: String!) Sets the hints that help an |
open Unit |
setAutofillId(id: AutofillId?) Sets the unique, logical identifier of this view in the activity, for autofill purposes. |
open Unit |
setBackground(background: Drawable!) Set the background to a given Drawable, or remove the background. |
open Unit |
setBackgroundColor(color: Int) Sets the background color for this view. |
open Unit |
setBackgroundDrawable(background: Drawable!) |
open Unit |
setBackgroundResource(resid: Int) Set the background to a given resource. |
open Unit |
setBackgroundTintBlendMode(blendMode: BlendMode?) Specifies the blending mode used to apply the tint specified by |
open Unit |
setBackgroundTintList(tint: ColorStateList?) Applies a tint to the background drawable. |
open Unit |
setBackgroundTintMode(tintMode: PorterDuff.Mode?) Specifies the blending mode used to apply the tint specified by |
Unit |
Sets the bottom position of this view relative to its parent. |
open Unit |
setCameraDistance(distance: Float) Sets the distance along the Z axis (orthogonal to the X/Y plane on which views are drawn) from the camera to this view. |
open Unit |
setClickable(clickable: Boolean) Enables or disables click events for this view. |
open Unit |
setClipBounds(clipBounds: Rect!) Sets a rectangular area on this view to which the view will be clipped when it is drawn. |
open Unit |
setClipToOutline(clipToOutline: Boolean) Sets whether the View's Outline should be used to clip the contents of the View. |
open Unit |
setContentCaptureSession(contentCaptureSession: ContentCaptureSession?) Sets the (optional) |
open Unit |
setContentDescription(contentDescription: CharSequence!) Sets the |
Unit |
setContentSensitivity(mode: Int) Sets content sensitivity mode to determine whether this view displays sensitive content (e.g. username, password etc.). |
open Unit |
setContextClickable(contextClickable: Boolean) Enables or disables context clicking for this view. |
open Unit |
setDefaultFocusHighlightEnabled(defaultFocusHighlightEnabled: Boolean) Sets whether this View should use a default focus highlight when it gets focused but doesn't have |
open Unit |
setDrawingCacheBackgroundColor(color: Int) Setting a solid background color for the drawing cache's bitmaps will improve performance and memory usage. |
open Unit |
setDrawingCacheEnabled(enabled: Boolean) Enables or disables the drawing cache. |
open Unit |
setDrawingCacheQuality(quality: Int) Set the drawing cache quality of this view. |
open Unit |
setDuplicateParentStateEnabled(enabled: Boolean) Enables or disables the duplication of the parent's state into this view. |
open Unit |
setElevation(elevation: Float) Sets the base elevation of this view, in pixels. |
open Unit |
setEnabled(enabled: Boolean) Set the enabled state of this view. |
open Unit |
setFadingEdgeLength(length: Int) Set the size of the faded edge used to indicate that more content in this view is available. |
open Unit |
setFilterTouchesWhenObscured(enabled: Boolean) Sets whether the framework should discard touches when the view's window is obscured by another visible window at the touched location. |
open Unit |
setFitsSystemWindows(fitSystemWindows: Boolean) 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 |
open Unit |
setFocusable(focusable: Boolean) Set whether this view can receive the focus. |
open Unit |
setFocusable(focusable: Int) Sets whether this view can receive focus. |
open Unit |
setFocusableInTouchMode(focusableInTouchMode: Boolean) Set whether this view can receive focus while in touch mode. |
open Unit |
setFocusedByDefault(isFocusedByDefault: Boolean) Sets whether this View should receive focus when the focus is restored for the view hierarchy containing this view. |
open Unit |
setForceDarkAllowed(allow: Boolean) Sets whether or not to allow force dark to apply to this view. |
open Unit |
setForeground(foreground: Drawable!) Supply a Drawable that is to be rendered on top of all of the content in the view. |
open Unit |
setForegroundGravity(gravity: Int) Describes how the foreground is positioned. |
open Unit |
setForegroundTintBlendMode(blendMode: BlendMode?) Specifies the blending mode used to apply the tint specified by |
open Unit |
setForegroundTintList(tint: ColorStateList?) Applies a tint to the foreground drawable. |
open Unit |
setForegroundTintMode(tintMode: PorterDuff.Mode?) Specifies the blending mode used to apply the tint specified by |
open Unit |
setFrameContentVelocity(pixelsPerSecond: Float) Set the current velocity of the View, we only track positive value. |
open Unit |
setHandwritingBoundsOffsets(offsetLeft: Float, offsetTop: Float, offsetRight: Float, offsetBottom: Float) Set the amount of offset applied to this view's stylus handwriting bounds. |
open Unit |
setHandwritingDelegateFlags(flags: Int) Sets flags configuring the handwriting delegation behavior for this delegate editor view. |
open Unit |
setHandwritingDelegatorCallback(callback: Runnable?) Sets a callback which should be called when a stylus |
open Unit |
setHapticFeedbackEnabled(hapticFeedbackEnabled: Boolean) Set whether this view should have haptic feedback for events such as long presses. |
open Unit |
setHasTransientState(hasTransientState: Boolean) Set whether this view is currently tracking transient state that the framework should attempt to preserve when possible. |
open Unit |
setHorizontalFadingEdgeEnabled(horizontalFadingEdgeEnabled: Boolean) Define whether the horizontal edges should be faded when this view is scrolled horizontally. |
open Unit |
setHorizontalScrollBarEnabled(horizontalScrollBarEnabled: Boolean) Define whether the horizontal scrollbar should be drawn or not. |
open Unit |
setHorizontalScrollbarThumbDrawable(drawable: Drawable?) Defines the horizontal thumb drawable |
open Unit |
setHorizontalScrollbarTrackDrawable(drawable: Drawable?) Defines the horizontal track drawable |
open Unit |
setHovered(hovered: Boolean) Sets whether the view is currently hovered. |
open Unit |
Sets the identifier for this view. |
open Unit |
setImportantForAccessibility(mode: Int) 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. |
open Unit |
setImportantForAutofill(mode: Int) Sets the mode for determining whether this view is considered important for autofill. |
open Unit |
setImportantForContentCapture(mode: Int) Sets the mode for determining whether this view is considered important for content capture. |
open Unit |
setIsCredential(isCredential: Boolean) Sets whether this view is a credential for Credential Manager purposes. |
open Unit |
setIsHandwritingDelegate(isHandwritingDelegate: Boolean) Sets this view to be a handwriting delegate. |
open Unit |
setKeepScreenOn(keepScreenOn: Boolean) Controls whether the screen should remain on, modifying the value of |
open Unit |
Set whether this view is a root of a keyboard navigation cluster. |
open Unit |
setLabelFor(id: Int) Sets the id of a view for which this view serves as a label for accessibility purposes. |
open Unit |
setLayerPaint(paint: Paint?) Updates the |
open Unit |
setLayerType(layerType: Int, paint: Paint?) Specifies the type of layer backing this view. |
open Unit |
setLayoutDirection(layoutDirection: Int) Set the layout direction for this view. |
open Unit |
setLayoutParams(params: ViewGroup.LayoutParams!) Set the layout parameters associated with this view. |
Unit |
Sets the left position of this view relative to its parent. |
Unit |
setLeftTopRightBottom(left: Int, top: Int, right: Int, bottom: Int) Assign a size and position to this view. |
open Unit |
setLongClickable(longClickable: Boolean) Enables or disables long click events for this view. |
open Unit |
setMinimumHeight(minHeight: Int) Sets the minimum height of the view. |
open Unit |
setMinimumWidth(minWidth: Int) Sets the minimum width of the view. |
open Unit |
setNestedScrollingEnabled(enabled: Boolean) Enable or disable nested scrolling for this view. |
open Unit |
setNextClusterForwardId(nextClusterForwardId: Int) Sets the id of the view to use as the root of the next keyboard navigation cluster. |
open Unit |
setNextFocusDownId(nextFocusDownId: Int) Sets the id of the view to use when the next focus is |
open Unit |
setNextFocusForwardId(nextFocusForwardId: Int) Sets the id of the view to use when the next focus is |
open Unit |
setNextFocusLeftId(nextFocusLeftId: Int) Sets the id of the view to use when the next focus is |
open Unit |
setNextFocusRightId(nextFocusRightId: Int) Sets the id of the view to use when the next focus is |
open Unit |
setNextFocusUpId(nextFocusUpId: Int) Sets the id of the view to use when the next focus is |
open Unit |
Set an |
open Unit |
Set a listener to receive callbacks when the pointer capture state of a view changes. |
open Unit |
Register a callback to be invoked when this view is clicked. |
open Unit |
Register a callback to be invoked when this view is context clicked. |
open Unit |
Register a callback to be invoked when the context menu for this view is being built. |
open Unit |
Register a drag event listener callback object for this View. |
open Unit |
Register a callback to be invoked when focus of this view changed. |
open Unit |
Register a callback to be invoked when a generic motion event is sent to this view. |
open Unit |
Register a callback to be invoked when a hover event is sent to this view. |
open Unit |
Register a callback to be invoked when a hardware key is pressed in this view. |
open Unit |
Register a callback to be invoked when this view is clicked and held. |
open Unit |
setOnReceiveContentListener(mimeTypes: Array<String!>?, listener: OnReceiveContentListener?) Sets the listener to be |
open Unit |
Register a callback to be invoked when the scroll X or Y positions of this view change. |
open Unit |
Set a listener to receive callbacks when the visibility of the system bar changes. |
open Unit |
Register a callback to be invoked when a touch event is sent to this view. |
open Unit |
setOutlineAmbientShadowColor(color: Int) Sets the color of the ambient shadow that is drawn when the view has a positive Z or elevation value. |
open Unit |
setOutlineProvider(provider: ViewOutlineProvider!) Sets the |
open Unit |
setOutlineSpotShadowColor(color: Int) Sets the color of the spot shadow that is drawn when the view has a positive Z or elevation value. |
open Unit |
setOverScrollMode(overScrollMode: Int) Set the over-scroll mode for this view. |
open Unit |
setPadding(left: Int, top: Int, right: Int, bottom: Int) Sets the padding. |
open Unit |
setPaddingRelative(start: Int, top: Int, end: Int, bottom: Int) Sets the relative padding. |
open Unit |
setPendingCredentialRequest(request: GetCredentialRequest, callback: OutcomeReceiver<GetCredentialResponse!, GetCredentialException!>) Sets a |
open Unit |
Sets the x location of the point around which the view is |
open Unit |
Sets the y location of the point around which the view is |
open Unit |
setPointerIcon(pointerIcon: PointerIcon!) Set the pointer icon to be used for a mouse pointer in the current view. |
Unit |
setPreferKeepClear(preferKeepClear: Boolean) Set a preference to keep the bounds of this view clear from floating windows above this view's window. |
Unit |
setPreferKeepClearRects(rects: MutableList<Rect!>) Set a preference to keep the provided rects clear from floating windows above this view's window. |
open Unit |
setPressed(pressed: Boolean) Sets the pressed state for this view. |
open Unit |
setRenderEffect(renderEffect: RenderEffect?) Configure the |
open Unit |
setRequestedFrameRate(frameRate: Float) You can set the preferred frame rate for a View using a positive number or by specifying the preferred frame rate category using constants, including REQUESTED_FRAME_RATE_CATEGORY_NO_PREFERENCE, REQUESTED_FRAME_RATE_CATEGORY_LOW, REQUESTED_FRAME_RATE_CATEGORY_NORMAL, REQUESTED_FRAME_RATE_CATEGORY_HIGH. |
Unit |
setRevealOnFocusHint(revealOnFocus: Boolean) Sets this view's preference for reveal behavior when it gains focus. |
Unit |
Sets the right position of this view relative to its parent. |
open Unit |
setRotation(rotation: Float) Sets the degrees that the view is rotated around the pivot point. |
open Unit |
setRotationX(rotationX: Float) Sets the degrees that the view is rotated around the horizontal axis through the pivot point. |
open Unit |
setRotationY(rotationY: Float) Sets the degrees that the view is rotated around the vertical axis through the pivot point. |
open Unit |
setSaveEnabled(enabled: Boolean) Controls whether the saving of this view's state is enabled (that is, whether its |
open Unit |
setSaveFromParentEnabled(enabled: Boolean) Controls whether the entire hierarchy under this view will save its state when a state saving traversal occurs from its parent. |
open Unit |
Sets the amount that the view is scaled in x around the pivot point, as a proportion of the view's unscaled width. |
open Unit |
Sets the amount that the view is scaled in Y around the pivot point, as a proportion of the view's unscaled width. |
open Unit |
setScreenReaderFocusable(screenReaderFocusable: Boolean) Sets whether this View should be a focusable element for screen readers and include non-focusable Views from its subtree when providing feedback. |
open Unit |
setScrollBarDefaultDelayBeforeFade(scrollBarDefaultDelayBeforeFade: Int) Define the delay before scrollbars fade. |
open Unit |
setScrollBarFadeDuration(scrollBarFadeDuration: Int) Define the scrollbar fade duration. |
open Unit |
setScrollBarSize(scrollBarSize: Int) Define the scrollbar size. |
open Unit |
setScrollBarStyle(style: Int) Specify the style of the scrollbars. |
Unit |
setScrollCaptureCallback(callback: ScrollCaptureCallback?) Sets the callback to receive scroll capture requests. |
open Unit |
setScrollCaptureHint(hint: Int) Sets the scroll capture hint for this View. |
open Unit |
setScrollContainer(isScrollContainer: Boolean) Change whether this view is one of the set of scrollable containers in its window. |
open Unit |
setScrollIndicators(indicators: Int) Sets the state of all scroll indicators. |
open Unit |
setScrollIndicators(indicators: Int, mask: Int) Sets the state of the scroll indicators specified by the mask. |
open Unit |
setScrollX(value: Int) Set the horizontal scrolled position of your view. |
open Unit |
setScrollY(value: Int) Set the vertical scrolled position of your view. |
open Unit |
setScrollbarFadingEnabled(fadeScrollbars: Boolean) Define whether scrollbars will fade when the view is not scrolling. |
open Unit |
setSelected(selected: Boolean) Changes the selection state of this view. |
open Unit |
setSoundEffectsEnabled(soundEffectsEnabled: Boolean) Set whether this view should have sound effects enabled for events such as clicking and touching. |
open Unit |
setStateDescription(stateDescription: CharSequence?) Sets the |
open Unit |
setStateListAnimator(stateListAnimator: StateListAnimator!) Attaches the provided StateListAnimator to this View. |
open Unit |
setSupplementalDescription(supplementalDescription: CharSequence?) Sets the |
open Unit |
setSystemGestureExclusionRects(rects: MutableList<Rect!>) Sets a list of areas within this view's post-layout coordinate space where the system should not intercept touch or other pointing device gestures. |
open Unit |
setSystemUiVisibility(visibility: Int) Request that the visibility of the status bar or other screen/window decorations be changed. |
open Unit |
Sets a tag associated with this view and a key. |
open Unit |
Sets the tag associated with this view. |
open Unit |
setTextAlignment(textAlignment: Int) Set the text alignment. |
open Unit |
setTextDirection(textDirection: Int) Set the text direction. |
open Unit |
setTooltipText(tooltipText: CharSequence?) Sets the tooltip text which will be displayed in a small popup next to the view. |
Unit |
Sets the top position of this view relative to its parent. |
open Unit |
setTouchDelegate(delegate: TouchDelegate!) Sets the TouchDelegate for this View. |
open Unit |
setTransitionAlpha(alpha: Float) This property is intended only for use by the Fade transition, which animates it to produce a visual translucency that does not side-effect (or get affected by) the real alpha property. |
Unit |
setTransitionName(transitionName: String!) Sets the name of the View to be used to identify Views in Transitions. |
open Unit |
setTransitionVisibility(visibility: Int) Changes the visibility of this View without triggering any other changes. |
open Unit |
setTranslationX(translationX: Float) Sets the horizontal location of this view relative to its |
open Unit |
setTranslationY(translationY: Float) Sets the vertical location of this view relative to its |
open Unit |
setTranslationZ(translationZ: Float) Sets the depth location of this view relative to its |
open Unit |
setVerticalFadingEdgeEnabled(verticalFadingEdgeEnabled: Boolean) Define whether the vertical edges should be faded when this view is scrolled vertically. |
open Unit |
setVerticalScrollBarEnabled(verticalScrollBarEnabled: Boolean) Define whether the vertical scrollbar should be drawn or not. |
open Unit |
setVerticalScrollbarPosition(position: Int) Set the position of the vertical scroll bar. |
open Unit |
setVerticalScrollbarThumbDrawable(drawable: Drawable?) Defines the vertical scrollbar thumb drawable |
open Unit |
setVerticalScrollbarTrackDrawable(drawable: Drawable?) Defines the vertical scrollbar track drawable |
open Unit |
Sets a |
open Unit |
setVisibility(visibility: Int) Set the visibility state of this view. |
open Unit |
setWillNotCacheDrawing(willNotCacheDrawing: Boolean) When a View's drawing cache is enabled, drawing is redirected to an offscreen bitmap. |
open Unit |
setWillNotDraw(willNotDraw: Boolean) If this view doesn't do any drawing on its own, set this flag to allow further optimizations. |
open Unit |
Sets a |
open Unit |
Sets the visual x position of this view, in pixels. |
open Unit |
Sets the visual y position of this view, in pixels. |
open Unit |
Sets the visual z position of this view, in pixels. |
open Boolean |
Shows the context menu for this view. |
open Boolean |
showContextMenu(x: Float, y: Float) Shows the context menu for this view anchored to the specified view-relative coordinate. |
open ActionMode! |
startActionMode(callback: ActionMode.Callback!) Start an action mode with the default type |
open ActionMode! |
startActionMode(callback: ActionMode.Callback!, type: Int) Start an action mode with the given type. |
open Unit |
startAnimation(animation: Animation!) Start the specified animation now. |
Boolean |
startDrag(data: ClipData!, shadowBuilder: View.DragShadowBuilder!, myLocalState: Any!, flags: Int) |
Boolean |
startDragAndDrop(data: ClipData!, shadowBuilder: View.DragShadowBuilder!, myLocalState: Any!, flags: Int) Starts a drag and drop operation. |
open Boolean |
startNestedScroll(axes: Int) Begin a nestable scroll operation along the given axes. |
open Unit |
Stop a nested scroll in progress. |
open String |
toString() |
open Unit |
transformMatrixToGlobal(matrix: Matrix) Modifies the input matrix such that it maps view-local coordinates to on-screen coordinates. |
open Unit |
transformMatrixToLocal(matrix: Matrix) Modifies the input matrix such that it maps on-screen coordinates to view-local coordinates. |
open Unit |
unscheduleDrawable(who: Drawable!) Unschedule any events associated with the given Drawable. |
open Unit |
unscheduleDrawable(who: Drawable, what: Runnable) Cancels a scheduled action on a drawable. |
Unit |
updateDragShadow(shadowBuilder: View.DragShadowBuilder!) Updates the drag shadow for the ongoing drag and drop operation. |
open Boolean |
Returns whether or not this View can cache its drawing or not. |
open Boolean |
Returns whether or not this View draws on its own. |
Protected methods | |
---|---|
open Boolean |
Trigger the scrollbars to draw. |
open Boolean |
awakenScrollBars(startDelay: Int) Trigger the scrollbars to draw. |
open Boolean |
awakenScrollBars(startDelay: Int, invalidate: Boolean) Trigger the scrollbars to draw. |
open Int |
Compute the horizontal extent of the horizontal scrollbar's thumb within the horizontal range. |
open Int |
Compute the horizontal offset of the horizontal scrollbar's thumb within the horizontal range. |
open Int |
Compute the horizontal range that the horizontal scrollbar represents. |
open Int |
Compute the vertical extent of the vertical scrollbar's thumb within the vertical range. |
open Int |
Compute the vertical offset of the vertical scrollbar's thumb within the horizontal range. |
open Int |
Compute the vertical range that the vertical scrollbar represents. |
open Unit |
dispatchDraw(canvas: Canvas) Called by draw to draw the child views. |
open Boolean |
dispatchGenericFocusedEvent(event: MotionEvent!) Dispatch a generic motion event to the currently focused view. |
open Boolean |
dispatchGenericPointerEvent(event: MotionEvent!) Dispatch a generic motion event to the view under the first pointer. |
open Boolean |
dispatchHoverEvent(event: MotionEvent!) Dispatch a hover event. |
open Unit |
dispatchRestoreInstanceState(container: SparseArray<Parcelable!>!) Called by |
open Unit |
dispatchSaveInstanceState(container: SparseArray<Parcelable!>!) Called by |
open Unit |
dispatchSetActivated(activated: Boolean) Dispatch setActivated to all of this View's children. |
open Unit |
dispatchSetPressed(pressed: Boolean) Dispatch setPressed to all of this View's children. |
open Unit |
dispatchSetSelected(selected: Boolean) Dispatch setSelected to all of this View's children. |
open Unit |
dispatchVisibilityChanged(changedView: View, visibility: Int) Dispatch a view visibility change down the view hierarchy. |
open Unit |
This function is called whenever the state of the view changes in such a way that it impacts the state of drawables being shown. |
open Boolean |
fitSystemWindows(insets: Rect!) Called by the view hierarchy when the content insets for a window have changed, to allow it to adjust its content to fit within those windows. |
open Float |
Returns the strength, or intensity, of the bottom faded edge. |
open Int |
Amount by which to extend the bottom fading region. |
open ContextMenu.ContextMenuInfo! |
Views should implement this if they have extra information to associate with the context menu. |
open Int |
Returns the height of the horizontal scrollbar. |
open Float |
Returns the strength, or intensity, of the left faded edge. |
open Int |
Amount by which to extend the left fading region. |
open Float |
Returns the strength, or intensity, of the right faded edge. |
open Int |
Amount by which to extend the right fading region. |
open Int |
Returns the suggested minimum height that the view should use. |
open Int |
Returns the suggested minimum width that the view should use. |
open Float |
Returns the strength, or intensity, of the top faded edge. |
open Int |
Amount by which to extend the top fading region. |
open Int | |
open Boolean |
If the View draws content inside its padding and enables fading edges, it needs to support padding offsets. |
open static IntArray! |
mergeDrawableStates(baseState: IntArray!, additionalState: IntArray!) Merge your own state values in additionalState into the base state values baseState that were returned by |
open Unit |
Invoked by a parent ViewGroup to notify the end of the animation currently associated with this view. |
open Unit |
Invoked by a parent ViewGroup to notify the start of the animation currently associated with this view. |
open Unit |
This is called when the view is attached to a window. |
open Unit |
onConfigurationChanged(newConfig: Configuration!) Called when the current configuration of the resources being used by the application have changed. |
open Unit |
Views should implement this if the view itself is going to add items to the context menu. |
open IntArray! |
onCreateDrawableState(extraSpace: Int) Generate the new |
open Unit |
This is called when the view is detached from a window. |
open Unit |
onDisplayHint(hint: Int) Gives this view a hint about whether is displayed or not. |
open Unit |
Implement this to do your drawing. |
Unit |
onDrawScrollBars(canvas: Canvas) Request the drawing of the horizontal and the vertical scrollbar. |
open Unit |
Finalize inflating a view from XML. |
open Unit |
onFocusChanged(gainFocus: Boolean, direction: Int, previouslyFocusedRect: Rect?) Called by the view system when the focus state of this view changes. |
open Unit |
Called from layout when this view should assign a size and position to each of its children. |
open Unit |
Measure the view and its content to determine the measured width and the measured height. |
open Unit |
onOverScrolled(scrollX: Int, scrollY: Int, clampedX: Boolean, clampedY: Boolean) Called by |
open Unit |
onRestoreInstanceState(state: Parcelable!) Hook allowing a view to re-apply a representation of its internal state that had previously been generated by |
open Parcelable? |
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. |
open Unit |
onScrollChanged(l: Int, t: Int, oldl: Int, oldt: Int) This is called in response to an internal scroll in this view (i.e., the view scrolled its own contents). |
open Boolean |
onSetAlpha(alpha: Int) Invoked if there is a Transform that involves alpha. |
open Unit |
onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) This is called during layout when the size of this view has changed. |
open Unit |
onVisibilityChanged(changedView: View, visibility: Int) Called when the visibility of the view or an ancestor of the view has changed. |
open Unit |
onWindowVisibilityChanged(visibility: Int) Called when the window containing has change its visibility (between |
open Boolean |
overScrollBy(deltaX: Int, deltaY: Int, scrollX: Int, scrollY: Int, scrollRangeX: Int, scrollRangeY: Int, maxOverScrollX: Int, maxOverScrollY: Int, isTouchEvent: Boolean) Scroll the view with standard behavior for scrolling beyond the normal content boundaries. |
Unit |
setMeasuredDimension(measuredWidth: Int, measuredHeight: Int) This method must be called by |
open Boolean |
verifyDrawable(who: Drawable) If your view subclass is displaying its own Drawable objects, it should override this function and return true for any Drawable it is displaying. |
Properties | |
---|---|
static Property<View!, Float!>! |
A Property wrapper around the |
static IntArray! |
Indicates the view has no states set. |
static IntArray! |
Indicates the view is enabled, focused and selected. |
static IntArray! |
Indicates the view is enabled, focused, selected and its window has the focus. |
static IntArray! |
Indicates the view is enabled and has the focus. |
static IntArray! |
Indicates the view is enabled, focused and its window has the focus. |
static IntArray! |
Indicates the view is enabled and selected. |
static IntArray! |
Indicates the view is enabled, selected and its window has the focus. |
static IntArray! |
Indicates the view is enabled. |
static IntArray! |
Indicates the view is enabled and that its window has focus. |
static IntArray! |
Indicates the view is focused and selected. |
static IntArray! |
Indicates the view is focused, selected and its window has the focus. |
static IntArray! |
Indicates the view is focused. |
static IntArray! |
Indicates the view has the focus and that its window has the focus. |
static IntArray! |
Indicates the view is pressed, enabled, focused and selected. |
static IntArray! |
Indicates the view is pressed, enabled, focused, selected and its window has the focus. |
static IntArray! |
Indicates the view is pressed, enabled and focused. |
static IntArray! |
Indicates the view is pressed, enabled, focused and its window has the focus. |
static IntArray! |
Indicates the view is pressed, enabled and selected. |
static IntArray! |
Indicates the view is pressed, enabled, selected and its window has the focus. |
static IntArray! |
Indicates the view is pressed and enabled. |
static IntArray! |
Indicates the view is pressed, enabled and its window has the focus. |
static IntArray! |
Indicates the view is pressed, focused and selected. |
static IntArray! |
Indicates the view is pressed, focused, selected and its window has the focus. |
static IntArray! |
Indicates the view is pressed and focused. |
static IntArray! |
Indicates the view is pressed, focused and its window has the focus. |
static IntArray! |
Indicates the view is pressed and selected. |
static IntArray! |
Indicates the view is pressed, selected and its window has the focus. |
static IntArray! |
Indicates the view is pressed. |
static IntArray! |
Indicates the view is pressed and its window has the focus. |
static Property<View!, Float!>! |
A Property wrapper around the |
static Property<View!, Float!>! |
A Property wrapper around the |
static Property<View!, Float!>! |
A Property wrapper around the |
static Property<View!, Float!>! |
A Property wrapper around the |
static Property<View!, Float!>! |
A Property wrapper around the |
static IntArray! |
Indicates the view is selected. |
static IntArray! |
Indicates the view is selected and that its window has the focus. |
static Property<View!, Float!>! |
A Property wrapper around the |
static Property<View!, Float!>! |
A Property wrapper around the |
static Property<View!, Float!>! |
A Property wrapper around the |
static IntArray! |
Indicates the view's window has focus. |
static Property<View!, Float!>! |
A Property wrapper around the |
static Property<View!, Float!>! |
A Property wrapper around the |
static Property<View!, Float!>! |
A Property wrapper around the |
XML attributes
android:accessibilityHeading
android:accessibilityHeading
May be a boolean value, such as "true
" or "false
".
android:allowClickWhenDisabled
android:allowClickWhenDisabled
May be a boolean value, such as "true
" or "false
".
android:alpha
android:alpha
May be a floating point value, such as "1.2
".
android:background
android:background
May be a reference to another resource, in the form "@[+][package:]type/name
" or a theme attribute in the form "?[package:]type/name
".
May be a color value, in the form of "rgb
", "argb
", "rrggbb
", or "aarrggbb
".
android:clickable
android:clickable
May be a boolean value, such as "true
" or "false
".
android:clipToOutline
android:clipToOutline
Whether the View's Outline should be used to clip the contents of the View.
Only a single non-rectangular clip can be applied on a View at any time. Circular clips from a android.view.ViewAnimationUtils#createCircularReveal(View, int, int, float, * float) circular reveal animation take priority over Outline clipping, and child Outline clipping takes priority over Outline clipping done by a parent.
Note that this flag will only be respected if the View's Outline returns true from android.graphics.Outline#canClip()
.
May be a boolean value, such as "true
" or "false
".
android:contentDescription
android:contentDescription
May be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character;
android:drawingCacheQuality
android:drawingCacheQuality
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. Deprecated: The view drawing cache was largely made obsolete with the introduction of hardware-accelerated rendering in API 11. |
high | 2 | High quality. When set to high quality, the drawing cache uses a higher color depth but uses more memory. Deprecated: The view drawing cache was largely made obsolete with the introduction of hardware-accelerated rendering in API 11. |
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. Deprecated: The view drawing cache was largely made obsolete with the introduction of hardware-accelerated rendering in API 11. |
android:duplicateParentState
android:duplicateParentState
May be a boolean value, such as "true
" or "false
".
android:fadeScrollbars
android:fadeScrollbars
May be a boolean value, such as "true
" or "false
".
android:fadingEdgeLength
android:fadingEdgeLength
May be a dimension value, which is a floating point number appended with a unit such as "14.5sp
". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).
android:filterTouchesWhenObscured
android:filterTouchesWhenObscured
android.view.View
security documentation for more details.
May be a boolean value, such as "true
" or "false
".
android:fitsSystemWindows
android:fitsSystemWindows
May be a boolean value, such as "true
" or "false
".
android:focusable
android:focusable
May be a boolean value, such as "true
" or "false
".
Must be one of the following constant values.
Constant | Value | Description |
---|---|---|
auto | 10 |
android:focusableInTouchMode
android:focusableInTouchMode
May be a boolean value, such as "true
" or "false
".
android:focusedByDefault
android:focusedByDefault
android.view.View#setFocusedByDefault(boolean)
.
May be a boolean value, such as "true
" or "false
".
android:hapticFeedbackEnabled
android:hapticFeedbackEnabled
May be a boolean value, such as "true
" or "false
".
android:id
android:id
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)
.
May be a reference to another resource, in the form "@[+][package:]type/name
" or a theme attribute in the form "?[package:]type/name
".
android:isScrollContainer
android:isScrollContainer
May be a boolean value, such as "true
" or "false
".
android:keepScreenOn
android:keepScreenOn
May be a boolean value, such as "true
" or "false
".
android:keyboardNavigationCluster
android:keyboardNavigationCluster
android.view.View#setKeyboardNavigationCluster(boolean)
.
May be a boolean value, such as "true
" or "false
".
android:layerType
android:layerType
android.view.View#setLayerType(int, android.graphics.Paint)
for more information.
Must be one of the following constant values.
Constant | Value | Description |
---|---|---|
hardware | 2 | Use a hardware layer. Refer to android.view.View#setLayerType(int, android.graphics.Paint) for more information. |
none | 0 | Don't use a layer. |
software | 1 | Use a software layer. Refer to android.view.View#setLayerType(int, android.graphics.Paint) for more information. |
android:layoutDirection
android:layoutDirection
Must be one of the following constant values.
Constant | Value | Description |
---|---|---|
inherit | 2 | Inherit from parent. |
locale | 3 | Locale. |
ltr | 0 | Left-to-Right. |
rtl | 1 | Right-to-Left. |
android:longClickable
android:longClickable
May be a boolean value, such as "true
" or "false
".
android:minHeight
android:minHeight
May be a dimension value, which is a floating point number appended with a unit such as "14.5sp
". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).
android:minWidth
android:minWidth
May be a dimension value, which is a floating point number appended with a unit such as "14.5sp
". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).
android:nextClusterForward
android:nextClusterForward
java.lang.RuntimeException
will result when the reference is accessed.
May be a reference to another resource, in the form "@[+][package:]type/name
" or a theme attribute in the form "?[package:]type/name
".
android:nextFocusDown
android:nextFocusDown
android.view.View#FOCUS_DOWN
If the reference refers to a view that does not exist or is part of a hierarchy that is invisible, a java.lang.RuntimeException
will result when the reference is accessed.
May be a reference to another resource, in the form "@[+][package:]type/name
" or a theme attribute in the form "?[package:]type/name
".
android:nextFocusLeft
android:nextFocusLeft
android.view.View#FOCUS_LEFT
. If the reference refers to a view that does not exist or is part of a hierarchy that is invisible, a java.lang.RuntimeException
will result when the reference is accessed.
May be a reference to another resource, in the form "@[+][package:]type/name
" or a theme attribute in the form "?[package:]type/name
".
android:nextFocusRight
android:nextFocusRight
android.view.View#FOCUS_RIGHT
If the reference refers to a view that does not exist or is part of a hierarchy that is invisible, a java.lang.RuntimeException
will result when the reference is accessed.
May be a reference to another resource, in the form "@[+][package:]type/name
" or a theme attribute in the form "?[package:]type/name
".
android:nextFocusUp
android:nextFocusUp
android.view.View#FOCUS_UP
If the reference refers to a view that does not exist or is part of a hierarchy that is invisible, a java.lang.RuntimeException
will result when the reference is accessed.
May be a reference to another resource, in the form "@[+][package:]type/name
" or a theme attribute in the form "?[package:]type/name
".
android:onClick
android:onClick
android:onClick="sayHello"
, you must declare a public void sayHello(View v)
method of your context (typically, your Activity). {@deprecated View actually traverses the Context * hierarchy looking for the relevant method, which is fragile (an intermediate * ContextWrapper adding a same-named method would change behavior) and restricts * bytecode optimizers such as R8. Instead, use View.setOnClickListener.}
May be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character;
android:outlineAmbientShadowColor
android:outlineAmbientShadowColor
By default the shadow color is black. Generally, this color will be opaque so the intensity of the shadow is consistent between different views with different colors.
The opacity of the final ambient shadow is a function of the shadow caster height, the alpha channel of the outlineAmbientShadowColor (typically opaque), and the android.R.attr#ambientShadowAlpha
theme attribute.
May be a color value, in the form of "rgb
", "argb
", "rrggbb
", or "aarrggbb
".
android:outlineSpotShadowColor
android:outlineSpotShadowColor
By default the shadow color is black. Generally, this color will be opaque so the intensity of the shadow is consistent between different views with different colors.
The opacity of the final spot shadow is a function of the shadow caster height, the alpha channel of the outlineSpotShadowColor (typically opaque), and the android.R.attr#spotShadowAlpha
theme attribute.
May be a color value, in the form of "rgb
", "argb
", "rrggbb
", or "aarrggbb
".
android:padding
android:padding
android.R.attr#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.
May be a dimension value, which is a floating point number appended with a unit such as "14.5sp
". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).
android:paddingBottom
android:paddingBottom
android.R.attr#padding
.
May be a dimension value, which is a floating point number appended with a unit such as "14.5sp
". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).
android:paddingEnd
android:paddingEnd
android.R.attr#padding
.
May be a dimension value, which is a floating point number appended with a unit such as "14.5sp
". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).
android:paddingHorizontal
android:paddingHorizontal
android.R.attr#padding
. This value will take precedence over paddingLeft and paddingRight, but not paddingStart or paddingEnd (if set).
May be a dimension value, which is a floating point number appended with a unit such as "14.5sp
". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).
android:paddingLeft
android:paddingLeft
android.R.attr#padding
.
May be a dimension value, which is a floating point number appended with a unit such as "14.5sp
". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).
android:paddingRight
android:paddingRight
android.R.attr#padding
.
May be a dimension value, which is a floating point number appended with a unit such as "14.5sp
". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).
android:paddingStart
android:paddingStart
android.R.attr#padding
.
May be a dimension value, which is a floating point number appended with a unit such as "14.5sp
". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).
android:paddingTop
android:paddingTop
android.R.attr#padding
.
May be a dimension value, which is a floating point number appended with a unit such as "14.5sp
". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).
android:paddingVertical
android:paddingVertical
android.R.attr#padding
. This value will take precedence over paddingTop and paddingBottom, if set.
May be a dimension value, which is a floating point number appended with a unit such as "14.5sp
". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).
android:requiresFadingEdge
android:requiresFadingEdge
Must be one or more (separated by '|') of the following constant values.
Constant | Value | Description |
---|---|---|
horizontal | 1000 | Fades horizontal edges only. |
none | 0 | No edge is faded. |
vertical | 2000 | Fades vertical edges only. |
android:rotation
android:rotation
May be a floating point value, such as "1.2
".
android:rotationX
android:rotationX
May be a floating point value, such as "1.2
".
android:rotationY
android:rotationY
May be a floating point value, such as "1.2
".
android:saveEnabled
android:saveEnabled
May be a boolean value, such as "true
" or "false
".
android:scaleX
android:scaleX
May be a floating point value, such as "1.2
".
android:scaleY
android:scaleY
May be a floating point value, such as "1.2
".
android:scrollX
android:scrollX
May be a dimension value, which is a floating point number appended with a unit such as "14.5sp
". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).
android:scrollY
android:scrollY
May be a dimension value, which is a floating point number appended with a unit such as "14.5sp
". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).
android:scrollbarAlwaysDrawHorizontalTrack
android:scrollbarAlwaysDrawHorizontalTrack
May be a boolean value, such as "true
" or "false
".
android:scrollbarAlwaysDrawVerticalTrack
android:scrollbarAlwaysDrawVerticalTrack
May be a boolean value, such as "true
" or "false
".
android:scrollbarDefaultDelayBeforeFade
android:scrollbarDefaultDelayBeforeFade
May be an integer value, such as "100
".
android:scrollbarFadeDuration
android:scrollbarFadeDuration
May be an integer value, such as "100
".
android:scrollbarSize
android:scrollbarSize
May be a dimension value, which is a floating point number appended with a unit such as "14.5sp
". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).
android:scrollbarStyle
android:scrollbarStyle
Must be one of the following constant values.
Constant | Value | Description |
---|---|---|
insideInset | 1000000 | Inside the padding and inset. |
insideOverlay | 0 | Inside the padding and overlaid. |
outsideInset | 3000000 | Edge of the view and inset. |
outsideOverlay | 2000000 | Edge of the view and overlaid. |
android:scrollbarThumbHorizontal
android:scrollbarThumbHorizontal
May be a reference to another resource, in the form "@[+][package:]type/name
" or a theme attribute in the form "?[package:]type/name
".
android:scrollbarThumbVertical
android:scrollbarThumbVertical
May be a reference to another resource, in the form "@[+][package:]type/name
" or a theme attribute in the form "?[package:]type/name
".
android:scrollbarTrackHorizontal
android:scrollbarTrackHorizontal
May be a reference to another resource, in the form "@[+][package:]type/name
" or a theme attribute in the form "?[package:]type/name
".
android:scrollbarTrackVertical
android:scrollbarTrackVertical
May be a reference to another resource, in the form "@[+][package:]type/name
" or a theme attribute in the form "?[package:]type/name
".
android:scrollbars
android:scrollbars
Must be one or more (separated by '|') of the following constant values.
Constant | Value | Description |
---|---|---|
horizontal | 100 | Displays horizontal scrollbar only. |
none | 0 | No scrollbar is displayed. |
vertical | 200 | Displays vertical scrollbar only. |
android:soundEffectsEnabled
android:soundEffectsEnabled
May be a boolean value, such as "true
" or "false
".
android:stateListAnimator
android:stateListAnimator
May be a reference to another resource, in the form "@[+][package:]type/name
" or a theme attribute in the form "?[package:]type/name
".
android:tag
android:tag
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.
May be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character;
android:textAlignment
android:textAlignment
May be an integer value, such as "100
".
Must be one of the following constant values.
Constant | Value | Description |
---|---|---|
center | 4 | Center the paragraph, for example: ALIGN_CENTER. |
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. |
inherit | 0 | Default. |
textEnd | 3 | Align to the end of the paragraph, for example: ALIGN_OPPOSITE. |
textStart | 2 | Align to the start of the paragraph, for example: ALIGN_NORMAL. |
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. |
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. |
android:textDirection
android:textDirection
May be an integer value, such as "100
".
Must be one of the following constant values.
Constant | Value | Description |
---|---|---|
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. |
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. |
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. |
inherit | 0 | Default. |
locale | 5 | The paragraph direction is coming from the system Locale. |
ltr | 3 | The paragraph direction is left to right. |
rtl | 4 | The paragraph direction is right to left. |
android:theme
android:theme
android.content.Context
themed with the specified resource. During XML inflation, any child views under the view with a theme override will inherit the themed context.
May be a reference to another resource, in the form "@[+][package:]type/name
" or a theme attribute in the form "?[package:]type/name
".
android:transformPivotX
android:transformPivotX
May be a dimension value, which is a floating point number appended with a unit such as "14.5sp
". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).
android:transformPivotY
android:transformPivotY
May be a dimension value, which is a floating point number appended with a unit such as "14.5sp
". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).
android:transitionName
android:transitionName
May be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character;
android:translationX
android:translationX
May be a dimension value, which is a floating point number appended with a unit such as "14.5sp
". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).
android:translationY
android:translationY
May be a dimension value, which is a floating point number appended with a unit such as "14.5sp
". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).
android:translationZ
android:translationZ
May be a dimension value, which is a floating point number appended with a unit such as "14.5sp
". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).
android:visibility
android:visibility
Must be one of the following constant values.
Constant | Value | Description |
---|---|---|
gone | 2 | Completely hidden, as if the view had not been added. |
invisible | 1 | Not displayed, but taken into account during layout (space is left for it). |
visible | 0 | Visible on screen; the default value. |
Constants
ACCESSIBILITY_DATA_SENSITIVE_AUTO
static val ACCESSIBILITY_DATA_SENSITIVE_AUTO: Int
Automatically determine whether the view should only allow interactions from android.accessibilityservice.AccessibilityService
s with the android.accessibilityservice.AccessibilityServiceInfo#isAccessibilityTool
property set to true.
Accessibility interactions from services without isAccessibilityTool
set to true are disallowed for any of the following conditions:
getFilterTouchesWhenObscured()
.isAccessibilityDataSensitive()
.Value: 0
ACCESSIBILITY_DATA_SENSITIVE_NO
static val ACCESSIBILITY_DATA_SENSITIVE_NO: Int
Allow interactions from all android.accessibilityservice.AccessibilityService
s, regardless of their android.accessibilityservice.AccessibilityServiceInfo#isAccessibilityTool
property.
Value: 2
ACCESSIBILITY_DATA_SENSITIVE_YES
static val ACCESSIBILITY_DATA_SENSITIVE_YES: Int
Only allow interactions from android.accessibilityservice.AccessibilityService
s with the android.accessibilityservice.AccessibilityServiceInfo#isAccessibilityTool
property set to true.
Value: 1
ACCESSIBILITY_LIVE_REGION_ASSERTIVE
static val ACCESSIBILITY_LIVE_REGION_ASSERTIVE: Int
Live region mode specifying that accessibility services should immediately notify users of changes to this view. For example, a screen reader may interrupt ongoing speech to immediately announce these changes.
Use with setAccessibilityLiveRegion(int)
.
Value: 2
ACCESSIBILITY_LIVE_REGION_NONE
static val ACCESSIBILITY_LIVE_REGION_NONE: 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)
.
Value: 0
ACCESSIBILITY_LIVE_REGION_POLITE
static val ACCESSIBILITY_LIVE_REGION_POLITE: Int
Live region mode specifying that accessibility services should notify users of changes to this view.
Use with setAccessibilityLiveRegion(int)
.
Value: 1
AUTOFILL_FLAG_INCLUDE_NOT_IMPORTANT_VIEWS
static val AUTOFILL_FLAG_INCLUDE_NOT_IMPORTANT_VIEWS: Int
Flag requesting you to add views that are marked as not important for autofill (see setImportantForAutofill(int)
) to a ViewStructure
.
Value: 1
AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DATE
static val AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DATE: String
Hint indicating that this view can be autofilled with a credit card expiration date.
It should be used when the credit card expiration date is represented by just one view; if it is represented by more than one (for example, one view for the month and another view for the year), then each of these views should use the hint specific for the unit (AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DAY
, AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_MONTH
, or AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_YEAR
).
Can be used with either setAutofillHints(java.lang.String[])
or android:autofillHint
(in which case the value should be {@value #AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DATE}
).
When annotating a view with this hint, it's recommended to use a date autofill value to avoid ambiguity when the autofill service provides a value for it. To understand why a value can be ambiguous, consider "April of 2020", which could be represented as either of the following options:
"04/2020"
"4/2020"
"2020/04"
"2020/4"
"April/2020"
"Apr/2020"
You define a date autofill value for the view by overriding the following methods:
getAutofillType()
to returnAUTOFILL_TYPE_DATE
.getAutofillValue()
to return adate autofillvalue
.autofill(android.view.autofill.AutofillValue)
to expect a data autofillvalue.
See setAutofillHints(java.lang.String...)
for more info about autofill hints.
Value: "creditCardExpirationDate"
AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DAY
static val AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DAY: String
Hint indicating that this view can be autofilled with a credit card expiration day.
Can be used with either setAutofillHints(java.lang.String[])
or android:autofillHint
(in which case the value should be {@value #AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DAY}
).
See setAutofillHints(java.lang.String...)
for more info about autofill hints.
Value: "creditCardExpirationDay"
AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_MONTH
static val AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_MONTH: String
Hint indicating that this view can be autofilled with a credit card expiration month.
Can be used with either setAutofillHints(java.lang.String[])
or android:autofillHint
(in which case the value should be {@value #AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_MONTH}
).
When annotating a view with this hint, it's recommended to use a text autofill value whose value is the numerical representation of the month, starting on 1
to avoid ambiguity when the autofill service provides a value for it. To understand why a value can be ambiguous, consider "January", which could be represented as either of
"1"
: recommended way."0"
: if following theCalendar.MONTH
convention."January"
: full name, in English."jan"
: abbreviated name, in English."Janeiro"
: full name, in another language.
Another recommended approach is to use a date autofill value - see AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DATE
for more details.
See setAutofillHints(java.lang.String...)
for more info about autofill hints.
Value: "creditCardExpirationMonth"
AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_YEAR
static val AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_YEAR: String
Hint indicating that this view can be autofilled with a credit card expiration year.
Can be used with either setAutofillHints(java.lang.String[])
or android:autofillHint
(in which case the value should be {@value #AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_YEAR}
).
See setAutofillHints(java.lang.String...)
for more info about autofill hints.
Value: "creditCardExpirationYear"
AUTOFILL_HINT_CREDIT_CARD_NUMBER
static val AUTOFILL_HINT_CREDIT_CARD_NUMBER: String
Hint indicating that this view can be autofilled with a credit card number.
Can be used with either setAutofillHints(java.lang.String[])
or android:autofillHint
(in which case the value should be {@value #AUTOFILL_HINT_CREDIT_CARD_NUMBER}
).
See setAutofillHints(java.lang.String...)
for more info about autofill hints.
Value: "creditCardNumber"
AUTOFILL_HINT_CREDIT_CARD_SECURITY_CODE
static val AUTOFILL_HINT_CREDIT_CARD_SECURITY_CODE: String
Hint indicating that this view can be autofilled with a credit card security code.
Can be used with either setAutofillHints(java.lang.String[])
or android:autofillHint
(in which case the value should be {@value #AUTOFILL_HINT_CREDIT_CARD_SECURITY_CODE}
).
See setAutofillHints(java.lang.String...)
for more info about autofill hints.
Value: "creditCardSecurityCode"
AUTOFILL_HINT_EMAIL_ADDRESS
static val AUTOFILL_HINT_EMAIL_ADDRESS: String
Hint indicating that this view can be autofilled with an email address.
Can be used with either setAutofillHints(java.lang.String[])
or android:autofillHint
(in which case the value should be {@value #AUTOFILL_HINT_EMAIL_ADDRESS}
).
See setAutofillHints(java.lang.String...)
for more info about autofill hints.
Value: "emailAddress"
AUTOFILL_HINT_NAME
static val AUTOFILL_HINT_NAME: String
Hint indicating that this view can be autofilled with a user's real name.
Can be used with either setAutofillHints(java.lang.String[])
or android:autofillHint
(in which case the value should be {@value #AUTOFILL_HINT_NAME}
).
See setAutofillHints(java.lang.String...)
for more info about autofill hints.
Value: "name"
AUTOFILL_HINT_PASSWORD
static val AUTOFILL_HINT_PASSWORD: String
Hint indicating that this view can be autofilled with a password.
Can be used with either setAutofillHints(java.lang.String[])
or android:autofillHint
(in which case the value should be {@value #AUTOFILL_HINT_PASSWORD}
).
See setAutofillHints(java.lang.String...)
for more info about autofill hints.
Value: "password"
AUTOFILL_HINT_PHONE
static val AUTOFILL_HINT_PHONE: String
Hint indicating that this view can be autofilled with a phone number.
Can be used with either setAutofillHints(java.lang.String[])
or android:autofillHint
(in which case the value should be {@value #AUTOFILL_HINT_PHONE}
).
See setAutofillHints(java.lang.String...)
for more info about autofill hints.
Value: "phone"
AUTOFILL_HINT_POSTAL_ADDRESS
static val AUTOFILL_HINT_POSTAL_ADDRESS: String
Hint indicating that this view can be autofilled with a postal address.
Can be used with either setAutofillHints(java.lang.String[])
or android:autofillHint
(in which case the value should be {@value #AUTOFILL_HINT_POSTAL_ADDRESS}
).
See setAutofillHints(java.lang.String...)
for more info about autofill hints.
Value: "postalAddress"
AUTOFILL_HINT_POSTAL_CODE
static val AUTOFILL_HINT_POSTAL_CODE: String
Hint indicating that this view can be autofilled with a postal code.
Can be used with either setAutofillHints(java.lang.String[])
or android:autofillHint
(in which case the value should be {@value #AUTOFILL_HINT_POSTAL_CODE}
).
See setAutofillHints(java.lang.String...)
for more info about autofill hints.
Value: "postalCode"
AUTOFILL_HINT_USERNAME
static val AUTOFILL_HINT_USERNAME: String
Hint indicating that this view can be autofilled with a username.
Can be used with either setAutofillHints(java.lang.String[])
or android:autofillHint
(in which case the value should be {@value #AUTOFILL_HINT_USERNAME}
).
See setAutofillHints(java.lang.String...)
for more info about autofill hints.
Value: "username"
AUTOFILL_TYPE_DATE
static val AUTOFILL_TYPE_DATE: Int
Autofill type for a field that contains a date, which is represented by a long representing the number of milliseconds since the standard base time known as "the epoch", namely January 1, 1970, 00:00:00 GMT (see java.util.Date#getTime()
.
AutofillValue
instances for autofilling a View
can be obtained through AutofillValue.forDate(long)
, and the values passed to autofill a View
can be fetched through AutofillValue.getDateValue()
.
Value: 4
See Also
AUTOFILL_TYPE_LIST
static val AUTOFILL_TYPE_LIST: Int
Autofill type for a selection list field, which is filled by an int
representing the element index inside the list (starting at 0
).
AutofillValue
instances for autofilling a View
can be obtained through AutofillValue.forList(int)
, and the value passed to autofill a View
can be fetched through AutofillValue.getListValue()
.
The available options in the selection list are typically provided by android.app.assist.AssistStructure.ViewNode#getAutofillOptions()
.
Value: 3
See Also
AUTOFILL_TYPE_NONE
static val AUTOFILL_TYPE_NONE: Int
Autofill type for views that cannot be autofilled.
Typically used when the view is read-only; for example, a text label.
Value: 0
See Also
AUTOFILL_TYPE_TEXT
static val AUTOFILL_TYPE_TEXT: Int
Autofill type for a text field, which is filled by a CharSequence
.
AutofillValue
instances for autofilling a View
can be obtained through AutofillValue.forText(CharSequence)
, and the value passed to autofill a View
can be fetched through AutofillValue.getTextValue()
.
Value: 1
See Also
AUTOFILL_TYPE_TOGGLE
static val AUTOFILL_TYPE_TOGGLE: Int
Autofill type for a togglable field, which is filled by a boolean
.
AutofillValue
instances for autofilling a View
can be obtained through AutofillValue.forToggle(boolean)
, and the value passed to autofill a View
can be fetched through AutofillValue.getToggleValue()
.
Value: 2
See Also
CONTENT_SENSITIVITY_AUTO
static val CONTENT_SENSITIVITY_AUTO: Int
Content sensitivity is determined by the framework. The framework uses a heuristic to determine if this view displays sensitive content. Autofill hints i.e. getAutofillHints()
are used in the heuristic to determine if this view should be considered as a sensitive view.
AUTOFILL_HINT_USERNAME
, AUTOFILL_HINT_PASSWORD
, AUTOFILL_HINT_CREDIT_CARD_NUMBER
, AUTOFILL_HINT_CREDIT_CARD_SECURITY_CODE
, AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DATE
, AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DAY
, AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_MONTH
, AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_YEAR
are considered sensitive hints by the framework, and the list may include more hints in the future.
The window hosting a sensitive view will be marked as secure during an active media projection session. This would be equivalent to applying android.view.WindowManager.LayoutParams#FLAG_SECURE
to the window.
Value: 0
See Also
CONTENT_SENSITIVITY_NOT_SENSITIVE
static val CONTENT_SENSITIVITY_NOT_SENSITIVE: Int
The view doesn't display sensitive content.
Value: 2
See Also
CONTENT_SENSITIVITY_SENSITIVE
static val CONTENT_SENSITIVITY_SENSITIVE: Int
The view displays sensitive content.
The window hosting a sensitive view will be marked as secure during an active media projection session. This would be equivalent to applying android.view.WindowManager.LayoutParams#FLAG_SECURE
to the window.
Value: 1
See Also
DRAG_FLAG_ACCESSIBILITY_ACTION
static val DRAG_FLAG_ACCESSIBILITY_ACTION: Int
Flag indicating that the drag was initiated with AccessibilityNodeInfo.AccessibilityAction.ACTION_DRAG_START
. When startDragAndDrop(android.content.ClipData,android.view.View.DragShadowBuilder,java.lang.Object,int)
is called, this is used by the system to perform a drag without animations.
Value: 1024
DRAG_FLAG_GLOBAL
static val DRAG_FLAG_GLOBAL: Int
Flag indicating that a drag can cross window boundaries. When startDragAndDrop(android.content.ClipData,android.view.View.DragShadowBuilder,java.lang.Object,int)
is called with this flag set, all visible applications with targetSdkVersion >= API 24
will be able to participate in the drag operation and receive the dragged content.
If this is the only flag set, then the drag recipient will only have access to text data and intents contained in the ClipData
object. Access to URIs contained in the ClipData
is determined by other DRAG_FLAG_GLOBAL_* flags
Value: 256
DRAG_FLAG_GLOBAL_PERSISTABLE_URI_PERMISSION
static val DRAG_FLAG_GLOBAL_PERSISTABLE_URI_PERMISSION: Int
When this flag is used with DRAG_FLAG_GLOBAL_URI_READ
and/or DRAG_FLAG_GLOBAL_URI_WRITE
, the URI permission grant can be persisted across device reboots until explicitly revoked with android.content.Context#revokeUriPermission(Uri, int)
Context.revokeUriPermission}.
Value: 64
DRAG_FLAG_GLOBAL_PREFIX_URI_PERMISSION
static val DRAG_FLAG_GLOBAL_PREFIX_URI_PERMISSION: Int
When this flag is used with DRAG_FLAG_GLOBAL_URI_READ
and/or DRAG_FLAG_GLOBAL_URI_WRITE
, the URI permission grant applies to any URI that is a prefix match against the original granted URI.
Value: 128
DRAG_FLAG_GLOBAL_SAME_APPLICATION
static val DRAG_FLAG_GLOBAL_SAME_APPLICATION: Int
Flag indicating that a drag can cross window boundaries (within the same application). When startDragAndDrop(android.content.ClipData,android.view.View.DragShadowBuilder,java.lang.Object,int)
is called with this flag set, only visible windows belonging to the same application (ie. share the same UID) with targetSdkVersion >= API 24
will be able to participate in the drag operation and receive the dragged content. If both DRAG_FLAG_GLOBAL_SAME_APPLICATION and DRAG_FLAG_GLOBAL are set, then DRAG_FLAG_GLOBAL_SAME_APPLICATION takes precedence and the drag will only go to visible windows from the same application.
Value: 4096
DRAG_FLAG_GLOBAL_URI_READ
static val DRAG_FLAG_GLOBAL_URI_READ: Int
When this flag is used with DRAG_FLAG_GLOBAL
, the drag recipient will be able to request read access to the content URI(s) contained in the ClipData
object.
Value: 1
DRAG_FLAG_GLOBAL_URI_WRITE
static val DRAG_FLAG_GLOBAL_URI_WRITE: Int
When this flag is used with DRAG_FLAG_GLOBAL
, the drag recipient will be able to request write access to the content URI(s) contained in the ClipData
object.
Value: 2
DRAG_FLAG_HIDE_CALLING_TASK_ON_DRAG_START
static val DRAG_FLAG_HIDE_CALLING_TASK_ON_DRAG_START: Int
Flag indicating that this drag will result in the caller activity's task to be hidden for the duration of the drag, which means that the source activity will not receive drag events for the current drag gesture. Only the current android.service.voice.VoiceInteractionService
may use this flag.
Value: 16384
DRAG_FLAG_OPAQUE
static val DRAG_FLAG_OPAQUE: Int
Flag indicating that the drag shadow will be opaque. When startDragAndDrop(android.content.ClipData,android.view.View.DragShadowBuilder,java.lang.Object,int)
is called with this flag set, the drag shadow will be opaque, otherwise, it will be semitransparent.
Value: 512
DRAG_FLAG_START_INTENT_SENDER_ON_UNHANDLED_DRAG
static val DRAG_FLAG_START_INTENT_SENDER_ON_UNHANDLED_DRAG: Int
Flag indicating that an unhandled drag should be delegated to the system to be started if no visible window wishes to handle the drop. When using this flag, the caller must provide ClipData with an Item that contains an immutable IntentSender to an activity to be launched (not a broadcast, service, etc). See ClipData.Item.Builder.setIntentSender(IntentSender)
. The system can decide to launch the intent or not based on factors like the current screen size or windowing mode. If the system does not launch the intent, it will be canceled via the normal drag and drop flow.
Value: 8192
DRAWING_CACHE_QUALITY_AUTO
static valDRAWING_CACHE_QUALITY_AUTO: Int
Deprecated: The view drawing cache was largely made obsolete with the introduction of hardware-accelerated rendering in API 11. With hardware-acceleration, intermediate cache layers are largely unnecessary and can easily result in a net loss in performance due to the cost of creating and updating the layer. In the rare cases where caching layers are useful, such as for alpha animations, setLayerType(int,android.graphics.Paint)
handles this with hardware rendering. For software-rendered snapshots of a small part of the View hierarchy or individual Views it is recommended to create a Canvas
from either a Bitmap
or android.graphics.Picture
and call draw(android.graphics.Canvas)
on the View. However these software-rendered usages are discouraged and have compatibility issues with hardware-only rendering features such as Config.HARDWARE
bitmaps, real-time shadows, and outline clipping. For screenshots of the UI for feedback reports or unit testing the PixelCopy
API is recommended.
Enables automatic quality mode for the drawing cache.
Value: 0
DRAWING_CACHE_QUALITY_HIGH
static valDRAWING_CACHE_QUALITY_HIGH: Int
Deprecated: The view drawing cache was largely made obsolete with the introduction of hardware-accelerated rendering in API 11. With hardware-acceleration, intermediate cache layers are largely unnecessary and can easily result in a net loss in performance due to the cost of creating and updating the layer. In the rare cases where caching layers are useful, such as for alpha animations, setLayerType(int,android.graphics.Paint)
handles this with hardware rendering. For software-rendered snapshots of a small part of the View hierarchy or individual Views it is recommended to create a Canvas
from either a Bitmap
or android.graphics.Picture
and call draw(android.graphics.Canvas)
on the View. However these software-rendered usages are discouraged and have compatibility issues with hardware-only rendering features such as Config.HARDWARE
bitmaps, real-time shadows, and outline clipping. For screenshots of the UI for feedback reports or unit testing the PixelCopy
API is recommended.
Enables high quality mode for the drawing cache.
Value: 1048576
DRAWING_CACHE_QUALITY_LOW
static valDRAWING_CACHE_QUALITY_LOW: Int
Deprecated: The view drawing cache was largely made obsolete with the introduction of hardware-accelerated rendering in API 11. With hardware-acceleration, intermediate cache layers are largely unnecessary and can easily result in a net loss in performance due to the cost of creating and updating the layer. In the rare cases where caching layers are useful, such as for alpha animations, setLayerType(int,android.graphics.Paint)
handles this with hardware rendering. For software-rendered snapshots of a small part of the View hierarchy or individual Views it is recommended to create a Canvas
from either a Bitmap
or android.graphics.Picture
and call draw(android.graphics.Canvas)
on the View. However these software-rendered usages are discouraged and have compatibility issues with hardware-only rendering features such as Config.HARDWARE
bitmaps, real-time shadows, and outline clipping. For screenshots of the UI for feedback reports or unit testing the PixelCopy
API is recommended.
Enables low quality mode for the drawing cache.
Value: 524288
FIND_VIEWS_WITH_CONTENT_DESCRIPTION
static val FIND_VIEWS_WITH_CONTENT_DESCRIPTION: Int
Find find views that contain the specified content description.
Value: 2
FIND_VIEWS_WITH_TEXT
static val FIND_VIEWS_WITH_TEXT: Int
Find views that render the specified text.
Value: 1
FOCUSABLE
static val FOCUSABLE: Int
This view wants keystrokes.
Use with setFocusable(int)
and android:focusable
.
Value: 1
FOCUSABLES_ALL
static val FOCUSABLES_ALL: Int
View flag indicating whether addFocusables(java.util.ArrayList,int,int)
should add all focusable Views regardless if they are focusable in touch mode.
Value: 0
FOCUSABLES_TOUCH_MODE
static val FOCUSABLES_TOUCH_MODE: Int
View flag indicating whether addFocusables(java.util.ArrayList,int,int)
should add only Views focusable in touch mode.
Value: 1
FOCUSABLE_AUTO
static val FOCUSABLE_AUTO: Int
This view determines focusability automatically. This is the default.
Use with setFocusable(int)
and android:focusable
.
Value: 16
FOCUS_BACKWARD
static val FOCUS_BACKWARD: Int
Use with focusSearch(int)
. Move focus to the previous selectable item.
Value: 1
FOCUS_DOWN
static val FOCUS_DOWN: Int
Use with focusSearch(int)
. Move focus down.
Value: 130
FOCUS_FORWARD
static val FOCUS_FORWARD: Int
Use with focusSearch(int)
. Move focus to the next selectable item.
Value: 2
FOCUS_LEFT
static val FOCUS_LEFT: Int
Use with focusSearch(int)
. Move focus to the left.
Value: 17
FOCUS_RIGHT
static val FOCUS_RIGHT: Int
Use with focusSearch(int)
. Move focus to the right.
Value: 66
FOCUS_UP
static val FOCUS_UP: Int
Use with focusSearch(int)
. Move focus up.
Value: 33
GONE
static val GONE: Int
This view is invisible, and it doesn't take any space for layout purposes. Use with setVisibility
and android:visibility
.
Value: 8
HAPTIC_FEEDBACK_ENABLED
static val HAPTIC_FEEDBACK_ENABLED: Int
View flag indicating whether this view should have haptic feedback enabled for events such as long presses.
Value: 268435456
IMPORTANT_FOR_ACCESSIBILITY_AUTO
static val IMPORTANT_FOR_ACCESSIBILITY_AUTO: Int
Automatically determine whether a view is important for accessibility.
Value: 0
IMPORTANT_FOR_ACCESSIBILITY_NO
static val IMPORTANT_FOR_ACCESSIBILITY_NO: Int
The view is not important for accessibility.
Value: 2
IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS
static val IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS: Int
The view is not important for accessibility, nor are any of its descendant views.
Value: 4
IMPORTANT_FOR_ACCESSIBILITY_YES
static val IMPORTANT_FOR_ACCESSIBILITY_YES: Int
The view is important for accessibility.
Value: 1
IMPORTANT_FOR_AUTOFILL_AUTO
static val IMPORTANT_FOR_AUTOFILL_AUTO: Int
Automatically determine whether a view is important for autofill.
Value: 0
IMPORTANT_FOR_AUTOFILL_NO
static val IMPORTANT_FOR_AUTOFILL_NO: Int
The view is not important for autofill, but its children (if any) will be traversed.
Value: 2
IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS
static val IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS: Int
The view is not important for autofill, and its children (if any) will not be traversed.
Value: 8
IMPORTANT_FOR_AUTOFILL_YES
static val IMPORTANT_FOR_AUTOFILL_YES: Int
The view is important for autofill, and its children (if any) will be traversed.
Value: 1
IMPORTANT_FOR_AUTOFILL_YES_EXCLUDE_DESCENDANTS
static val IMPORTANT_FOR_AUTOFILL_YES_EXCLUDE_DESCENDANTS: Int
The view is important for autofill, but its children (if any) will not be traversed.
Value: 4
IMPORTANT_FOR_CONTENT_CAPTURE_AUTO
static val IMPORTANT_FOR_CONTENT_CAPTURE_AUTO: Int
Automatically determine whether a view is important for content capture.
Value: 0
IMPORTANT_FOR_CONTENT_CAPTURE_NO
static val IMPORTANT_FOR_CONTENT_CAPTURE_NO: Int
The view is not important for content capture, but its children (if any) will be traversed.
Value: 2
IMPORTANT_FOR_CONTENT_CAPTURE_NO_EXCLUDE_DESCENDANTS
static val IMPORTANT_FOR_CONTENT_CAPTURE_NO_EXCLUDE_DESCENDANTS: Int
The view is not important for content capture, and its children (if any) will not be traversed.
Value: 8
IMPORTANT_FOR_CONTENT_CAPTURE_YES
static val IMPORTANT_FOR_CONTENT_CAPTURE_YES: Int
The view is important for content capture, and its children (if any) will be traversed.
Value: 1
IMPORTANT_FOR_CONTENT_CAPTURE_YES_EXCLUDE_DESCENDANTS
static val IMPORTANT_FOR_CONTENT_CAPTURE_YES_EXCLUDE_DESCENDANTS: Int
The view is important for content capture, but its children (if any) will not be traversed.
Value: 4
INVISIBLE
static val INVISIBLE: Int
This view is invisible, but it still takes up space for layout purposes. Use with setVisibility
and android:visibility
.
Value: 4
KEEP_SCREEN_ON
static val KEEP_SCREEN_ON: Int
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 WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
.
Value: 67108864
LAYER_TYPE_HARDWARE
static val LAYER_TYPE_HARDWARE: Int
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.
Value: 2
LAYER_TYPE_NONE
static val LAYER_TYPE_NONE: Int
Indicates that the view does not have a layer.
Value: 0
LAYER_TYPE_SOFTWARE
static val LAYER_TYPE_SOFTWARE: Int
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.)
Value: 1
LAYOUT_DIRECTION_INHERIT
static val LAYOUT_DIRECTION_INHERIT: Int
Horizontal layout direction of this view is inherited from its parent. Use with setLayoutDirection
.
Value: 2
LAYOUT_DIRECTION_LOCALE
static val LAYOUT_DIRECTION_LOCALE: Int
Horizontal layout direction of this view is from deduced from the default language script for the locale. Use with setLayoutDirection
.
Value: 3
LAYOUT_DIRECTION_LTR
static val LAYOUT_DIRECTION_LTR: Int
Horizontal layout direction of this view is from Left to Right. Use with setLayoutDirection
.
Value: 0
LAYOUT_DIRECTION_RTL
static val LAYOUT_DIRECTION_RTL: Int
Horizontal layout direction of this view is from Right to Left. Use with setLayoutDirection
.
Value: 1
MEASURED_HEIGHT_STATE_SHIFT
static val MEASURED_HEIGHT_STATE_SHIFT: 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)
.
Value: 16
MEASURED_SIZE_MASK
static val MEASURED_SIZE_MASK: Int
Bits of getMeasuredWidthAndState()
and getMeasuredWidthAndState()
that provide the actual measured size.
Value: 16777215
MEASURED_STATE_MASK
static val MEASURED_STATE_MASK: Int
Bits of getMeasuredWidthAndState()
and getMeasuredWidthAndState()
that provide the additional state bits.
Value: -16777216
MEASURED_STATE_TOO_SMALL
static val MEASURED_STATE_TOO_SMALL: Int
Bit of getMeasuredWidthAndState()
and getMeasuredWidthAndState()
that indicates the measured size is smaller that the space the view would like to have.
Value: 16777216
NOT_FOCUSABLE
static val NOT_FOCUSABLE: Int
This view does not want keystrokes.
Use with setFocusable(int)
and android:focusable
.
Value: 0
OVER_SCROLL_ALWAYS
static val OVER_SCROLL_ALWAYS: Int
Always allow a user to over-scroll this view, provided it is a view that can scroll.
Value: 0
OVER_SCROLL_IF_CONTENT_SCROLLS
static val OVER_SCROLL_IF_CONTENT_SCROLLS: Int
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.
Value: 1
OVER_SCROLL_NEVER
static val OVER_SCROLL_NEVER: Int
Never allow a user to over-scroll this view.
Value: 2
REQUESTED_FRAME_RATE_CATEGORY_DEFAULT
static val REQUESTED_FRAME_RATE_CATEGORY_DEFAULT: Float
Value: (0.0f/0.0f)
REQUESTED_FRAME_RATE_CATEGORY_HIGH
static val REQUESTED_FRAME_RATE_CATEGORY_HIGH: Float
Value: -4.0f
REQUESTED_FRAME_RATE_CATEGORY_LOW
static val REQUESTED_FRAME_RATE_CATEGORY_LOW: Float
Value: -2.0f
REQUESTED_FRAME_RATE_CATEGORY_NORMAL
static val REQUESTED_FRAME_RATE_CATEGORY_NORMAL: Float
Value: -3.0f
REQUESTED_FRAME_RATE_CATEGORY_NO_PREFERENCE
static val REQUESTED_FRAME_RATE_CATEGORY_NO_PREFERENCE: Float
Value: -1.0f
SCREEN_STATE_OFF
static val SCREEN_STATE_OFF: Int
Indicates that the screen has changed state and is now off.
Value: 0
See Also
SCREEN_STATE_ON
static val SCREEN_STATE_ON: Int
Indicates that the screen has changed state and is now on.
Value: 1
See Also
SCROLLBARS_INSIDE_INSET
static val SCROLLBARS_INSIDE_INSET: Int
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.
Value: 16777216
SCROLLBARS_INSIDE_OVERLAY
static val SCROLLBARS_INSIDE_OVERLAY: Int
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.
Value: 0
SCROLLBARS_OUTSIDE_INSET
static val SCROLLBARS_OUTSIDE_INSET: Int
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.
Value: 50331648
SCROLLBARS_OUTSIDE_OVERLAY
static val SCROLLBARS_OUTSIDE_OVERLAY: Int
The scrollbar style to display the scrollbars at the edge of the view, without increasing the padding. The scrollbars will be overlaid with translucency.
Value: 33554432
SCROLLBAR_POSITION_DEFAULT
static val SCROLLBAR_POSITION_DEFAULT: Int
Position the scroll bar at the default position as determined by the system.
Value: 0
SCROLLBAR_POSITION_LEFT
static val SCROLLBAR_POSITION_LEFT: Int
Position the scroll bar along the left edge.
Value: 1
SCROLLBAR_POSITION_RIGHT
static val SCROLLBAR_POSITION_RIGHT: Int
Position the scroll bar along the right edge.
Value: 2
SCROLL_AXIS_HORIZONTAL
static val SCROLL_AXIS_HORIZONTAL: Int
Indicates scrolling along the horizontal axis.
Value: 1
SCROLL_AXIS_NONE
static val SCROLL_AXIS_NONE: Int
Indicates no axis of view scrolling.
Value: 0
SCROLL_AXIS_VERTICAL
static val SCROLL_AXIS_VERTICAL: Int
Indicates scrolling along the vertical axis.
Value: 2
SCROLL_CAPTURE_HINT_AUTO
static val SCROLL_CAPTURE_HINT_AUTO: Int
The content of this view will be considered for scroll capture if scrolling is possible.
Value: 0
SCROLL_CAPTURE_HINT_EXCLUDE
static val SCROLL_CAPTURE_HINT_EXCLUDE: Int
Explicitly exclude this view as a potential scroll capture target. The system will not consider it. Mutually exclusive with SCROLL_CAPTURE_HINT_INCLUDE
, which this flag takes precedence over.
Value: 1
SCROLL_CAPTURE_HINT_EXCLUDE_DESCENDANTS
static val SCROLL_CAPTURE_HINT_EXCLUDE_DESCENDANTS: Int
Explicitly exclude all children of this view as potential scroll capture targets. This view is unaffected. Note: Excluded children are not considered, regardless of SCROLL_CAPTURE_HINT_INCLUDE
.
Value: 4
SCROLL_CAPTURE_HINT_INCLUDE
static val SCROLL_CAPTURE_HINT_INCLUDE: Int
Explicitly include this view as a potential scroll capture target. When locating a scroll capture target, this view will be prioritized before others without this flag. Mutually exclusive with SCROLL_CAPTURE_HINT_EXCLUDE
, which takes precedence.
Value: 2
SCROLL_INDICATOR_BOTTOM
static val SCROLL_INDICATOR_BOTTOM: Int
Scroll indicator direction for the bottom edge of the view.
Value: 2
SCROLL_INDICATOR_END
static val SCROLL_INDICATOR_END: Int
Scroll indicator direction for the ending edge of the view.
Resolved according to the view's layout direction, see getLayoutDirection()
for more information.
Value: 32
SCROLL_INDICATOR_LEFT
static val SCROLL_INDICATOR_LEFT: Int
Scroll indicator direction for the left edge of the view.
Value: 4
SCROLL_INDICATOR_RIGHT
static val SCROLL_INDICATOR_RIGHT: Int
Scroll indicator direction for the right edge of the view.
Value: 8
SCROLL_INDICATOR_START
static val SCROLL_INDICATOR_START: Int
Scroll indicator direction for the starting edge of the view.
Resolved according to the view's layout direction, see getLayoutDirection()
for more information.
Value: 16
SCROLL_INDICATOR_TOP
static val SCROLL_INDICATOR_TOP: Int
Scroll indicator direction for the top edge of the view.
Value: 1
SOUND_EFFECTS_ENABLED
static val SOUND_EFFECTS_ENABLED: Int
View flag indicating whether this view should have sound effects enabled for events such as clicking and touching.
Value: 134217728
STATUS_BAR_HIDDEN
static valSTATUS_BAR_HIDDEN: Int
Deprecated: Use SYSTEM_UI_FLAG_LOW_PROFILE
instead.
Value: 1
STATUS_BAR_VISIBLE
static valSTATUS_BAR_VISIBLE: Int
Deprecated: Use SYSTEM_UI_FLAG_VISIBLE
instead.
Value: 0
SYSTEM_UI_FLAG_FULLSCREEN
static valSYSTEM_UI_FLAG_FULLSCREEN: Int
Deprecated: Use WindowInsetsController.hide(int)
with Type.statusBars()
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.
Value: 4
See Also
SYSTEM_UI_FLAG_HIDE_NAVIGATION
static valSYSTEM_UI_FLAG_HIDE_NAVIGATION: Int
Deprecated: Use WindowInsetsController.hide(int)
with Type.navigationBars()
instead.
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.
Value: 2
See Also
SYSTEM_UI_FLAG_IMMERSIVE
static valSYSTEM_UI_FLAG_IMMERSIVE: Int
Deprecated: Use WindowInsetsController.BEHAVIOR_DEFAULT
instead.
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.
Value: 2048
SYSTEM_UI_FLAG_IMMERSIVE_STICKY
static valSYSTEM_UI_FLAG_IMMERSIVE_STICKY: Int
Deprecated: Use WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
instead.
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.
Value: 4096
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
static valSYSTEM_UI_FLAG_LAYOUT_FULLSCREEN: Int
Deprecated: For floating windows, use LayoutParams.setFitInsetsTypes(int)
with Type.statusBars()
()}. For non-floating windows that fill the screen, call Window.setDecorFitsSystemWindows(boolean)
with false
.
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(android.graphics.Rect)
method.
Note: on displays that have a DisplayCutout
, the window may still be placed differently than if SYSTEM_UI_FLAG_FULLSCREEN
was set, if the window's layoutInDisplayCutoutMode
is LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT
. To avoid this, use either of the other modes.
Value: 1024
See Also
android.view.WindowManager.LayoutParams#layoutInDisplayCutoutMode
android.view.WindowManager.LayoutParams#LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT
android.view.WindowManager.LayoutParams#LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
android.view.WindowManager.LayoutParams#LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER
SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
static valSYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION: Int
Deprecated: For floating windows, use LayoutParams.setFitInsetsTypes(int)
with Type.navigationBars()
. For non-floating windows that fill the screen, call Window.setDecorFitsSystemWindows(boolean)
with false
.
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(android.graphics.Rect)
method.
Value: 512
SYSTEM_UI_FLAG_LAYOUT_STABLE
static valSYSTEM_UI_FLAG_LAYOUT_STABLE: Int
Deprecated: Use WindowInsets.getInsetsIgnoringVisibility(int)
instead to retrieve insets that don't change when system bars change visibility state.
Flag for setSystemUiVisibility(int)
: When using other layout flags, we would like a stable view of the content insets given to fitSystemWindows(android.graphics.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 WindowManager.LayoutParams.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.
Value: 256
SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR
static valSYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR: Int
Deprecated: Use WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS
instead.
Flag for setSystemUiVisibility(int)
: Requests the navigation bar to draw in a mode that is compatible with light navigation bar backgrounds.
For this to take effect, the window must request FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
but not FLAG_TRANSLUCENT_NAVIGATION
.
Value: 16
SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
static valSYSTEM_UI_FLAG_LIGHT_STATUS_BAR: Int
Deprecated: Use WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS
instead.
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
.
Value: 8192
See Also
SYSTEM_UI_FLAG_LOW_PROFILE
static valSYSTEM_UI_FLAG_LOW_PROFILE: Int
Deprecated: Low profile mode is deprecated. Hide the system bars instead if the application needs to be in a unobtrusive mode. Use WindowInsetsController.hide(int)
with Type.systemBars()
.
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.
Value: 1
See Also
SYSTEM_UI_FLAG_VISIBLE
static valSYSTEM_UI_FLAG_VISIBLE: Int
Deprecated: SystemUiVisibility flags are deprecated. Use WindowInsetsController
instead.
Special constant for setSystemUiVisibility(int)
: View has requested the system UI (status bar) to be visible (the default).
Value: 0
See Also
SYSTEM_UI_LAYOUT_FLAGS
static valSYSTEM_UI_LAYOUT_FLAGS: Int
Deprecated: System UI layout flags are deprecated.
Flags that can impact the layout in relation to system UI.
Value: 1536
TEXT_ALIGNMENT_CENTER
static val TEXT_ALIGNMENT_CENTER: Int
Center the paragraph, e.g. ALIGN_CENTER. Use with setTextAlignment(int)
Value: 4
TEXT_ALIGNMENT_GRAVITY
static val TEXT_ALIGNMENT_GRAVITY: 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)
Value: 1
TEXT_ALIGNMENT_INHERIT
static val TEXT_ALIGNMENT_INHERIT: Int
Default text alignment. The text alignment of this View is inherited from its parent. Use with setTextAlignment(int)
Value: 0
TEXT_ALIGNMENT_TEXT_END
static val TEXT_ALIGNMENT_TEXT_END: Int
Align to the end of the paragraph, e.g. ALIGN_OPPOSITE. Use with setTextAlignment(int)
Value: 3
TEXT_ALIGNMENT_TEXT_START
static val TEXT_ALIGNMENT_TEXT_START: Int
Align to the start of the paragraph, e.g. ALIGN_NORMAL. Use with setTextAlignment(int)
Value: 2
TEXT_ALIGNMENT_VIEW_END
static val TEXT_ALIGNMENT_VIEW_END: 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)
Value: 6
TEXT_ALIGNMENT_VIEW_START
static val TEXT_ALIGNMENT_VIEW_START: 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)
Value: 5
TEXT_DIRECTION_ANY_RTL
static val TEXT_DIRECTION_ANY_RTL: 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.
Value: 2
TEXT_DIRECTION_FIRST_STRONG
static val TEXT_DIRECTION_FIRST_STRONG: Int
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.
Value: 1
TEXT_DIRECTION_FIRST_STRONG_LTR
static val TEXT_DIRECTION_FIRST_STRONG_LTR: Int
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.
Value: 6
TEXT_DIRECTION_FIRST_STRONG_RTL
static val TEXT_DIRECTION_FIRST_STRONG_RTL: Int
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.
Value: 7
TEXT_DIRECTION_INHERIT
static val TEXT_DIRECTION_INHERIT: Int
Text direction is inherited through ViewGroup
Value: 0
TEXT_DIRECTION_LOCALE
static val TEXT_DIRECTION_LOCALE: Int
Text direction is coming from the system Locale.
Value: 5
TEXT_DIRECTION_LTR
static val TEXT_DIRECTION_LTR: Int
Text direction is forced to LTR.
Value: 3
TEXT_DIRECTION_RTL
static val TEXT_DIRECTION_RTL: Int
Text direction is forced to RTL.
Value: 4
VIEW_LOG_TAG
protected static val VIEW_LOG_TAG: String
The logging tag used by this class with android.util.Log.
Value: "View"
VISIBLE
static val VISIBLE: Int
This view is visible. Use with setVisibility
and android:visibility
.
Value: 0
Public constructors
View
View(context: Context!)
Simple constructor to use when creating a view from code.
Parameters | |
---|---|
context |
Context!: The Context the view is running in, through which it can access the current theme, resources, etc. |
View
View(
context: Context!,
attrs: AttributeSet?)
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.
Parameters | |
---|---|
context |
Context!: The Context the view is running in, through which it can access the current theme, resources, etc. |
attrs |
AttributeSet?: The attributes of the XML tag that is inflating the view. This value may be null . |
See Also
View
View(
context: Context!,
attrs: AttributeSet?,
defStyleAttr: Int)
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.
Parameters | |
---|---|
context |
Context!: The Context the view is running in, through which it can access the current theme, resources, etc. |
attrs |
AttributeSet?: The attributes of the XML tag that is inflating the view. This value may be null . |
defStyleAttr |
Int: 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. |
See Also
View
View(
context: Context!,
attrs: AttributeSet?,
defStyleAttr: Int,
defStyleRes: Int)
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:
- Any attribute values in the given AttributeSet.
- The style resource specified in the AttributeSet (named "style").
- The default style specified by defStyleAttr.
- The default style specified by defStyleRes.
- The base values in this theme.
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.
Parameters | |
---|---|
context |
Context!: The Context the view is running in, through which it can access the current theme, resources, etc. |
attrs |
AttributeSet?: The attributes of the XML tag that is inflating the view. This value may be null . |
defStyleAttr |
Int: 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 |
Int: 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. |
See Also
Public methods
addChildrenForAccessibility
open fun addChildrenForAccessibility(outChildren: ArrayList<View!>!): Unit
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.
Parameters | |
---|---|
outChildren |
ArrayList<View!>!: The output list that will receive children for accessibility. |
addExtraDataToAccessibilityNodeInfo
open fun addExtraDataToAccessibilityNodeInfo(
info: AccessibilityNodeInfo,
extraDataKey: String,
arguments: Bundle?
): Unit
Adds extra data to an AccessibilityNodeInfo
based on an explicit request for the additional data.
This method only needs overloading if the node is marked as having extra data available.
Parameters | |
---|---|
info |
AccessibilityNodeInfo: The info to which to add the extra data. Never null . |
extraDataKey |
String: A key specifying the type of extra data to add to the info. The extra data should be added to the Bundle returned by the info's AccessibilityNodeInfo.getExtras method. Never null . |
arguments |
Bundle?: A Bundle holding any arguments relevant for this request. May be null if the service provided no arguments. |
addFocusables
open fun addFocusables(
views: ArrayList<View!>!,
direction: Int
): Unit
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.
Parameters | |
---|---|
views |
ArrayList<View!>!: Focusable views found so far |
direction |
Int: The direction of the focus Value is android.view.View#FOCUS_BACKWARD , android.view.View#FOCUS_FORWARD , android.view.View#FOCUS_LEFT , android.view.View#FOCUS_UP , android.view.View#FOCUS_RIGHT , or android.view.View#FOCUS_DOWN |
addFocusables
open fun addFocusables(
views: ArrayList<View!>!,
direction: Int,
focusableMode: Int
): Unit
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.
Parameters | |
---|---|
views |
ArrayList<View!>!: Focusable views found so far or null if all we are interested is the number of focusables. |
direction |
Int: The direction of the focus. Value is android.view.View#FOCUS_BACKWARD , android.view.View#FOCUS_FORWARD , android.view.View#FOCUS_LEFT , android.view.View#FOCUS_UP , android.view.View#FOCUS_RIGHT , or android.view.View#FOCUS_DOWN |
focusableMode |
Int: The type of focusables to be added. Value is either 0 or a combination of android.view.View#FOCUSABLES_ALL , and android.view.View#FOCUSABLES_TOUCH_MODE |
See Also
addKeyboardNavigationClusters
open fun addKeyboardNavigationClusters(
: MutableCollection<View!>,
: Int
): Unit
Adds any keyboard navigation cluster roots that are descendants of this view (possibly including this view if it is a cluster root itself) to views.
Parameters | |
---|---|
views |
MutableCollection<View!>: Keyboard navigation cluster roots found so far This value cannot be null . |
direction |
Int: Direction to look |
addOnAttachStateChangeListener
open fun addOnAttachStateChangeListener(listener: View.OnAttachStateChangeListener!): Unit
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(android.view.View.OnAttachStateChangeListener)
.
Parameters | |
---|---|
listener |
View.OnAttachStateChangeListener!: Listener to attach |
addOnLayoutChangeListener
open fun addOnLayoutChangeListener(listener: View.OnLayoutChangeListener!): Unit
Add a listener that will be called when the bounds of the view change due to layout processing.
Parameters | |
---|---|
listener |
View.OnLayoutChangeListener!: The listener that will be called when layout bounds change. |
addOnUnhandledKeyEventListener
open fun addOnUnhandledKeyEventListener(listener: View.OnUnhandledKeyEventListener!): Unit
Adds a listener which will receive unhandled KeyEvent
s. This must be called on the UI thread.
Parameters | |
---|---|
listener |
View.OnUnhandledKeyEventListener!: a receiver of unhandled KeyEvent s. |
See Also
addTouchables
open fun addTouchables(views: ArrayList<View!>!): Unit
Add any touchable views that are descendants of this view (possibly including this view if it is touchable itself) to views.
Parameters | |
---|---|
views |
ArrayList<View!>!: Touchable views found so far |
animate
open fun animate(): ViewPropertyAnimator!
This method returns a ViewPropertyAnimator object, which can be used to animate specific properties on this View.
Return | |
---|---|
ViewPropertyAnimator! |
ViewPropertyAnimator The ViewPropertyAnimator associated with this View. |
announceForAccessibility
open funannounceForAccessibility(text: CharSequence!): Unit
Deprecated: Use one of the methods described in the documentation above to semantically describe UI instead of using an announcement, as accessibility services may choose to ignore events dispatched with this method.
Convenience method for sending a AccessibilityEvent.TYPE_ANNOUNCEMENT
AccessibilityEvent
to suggest that an accessibility service announce the specified text to its users.
Note: The event generated with this API carries no semantic meaning, and accessibility services may choose to ignore it. Apps that accurately supply accessibility with the semantics of their UI should not need to specify what exactly is announced.
In general, do not attempt to generate announcements as confirmation message for simple actions like a button press. Label your controls concisely and precisely instead.
To convey significant UI changes like window changes, use android.app.Activity#setTitle(CharSequence)
and setAccessibilityPaneTitle(java.lang.CharSequence)
.
Use setAccessibilityLiveRegion(int)
to inform the user of changes to critical views within the user interface. These should still be used sparingly as they may generate announcements every time a View is updated.
Use setStateDescription(java.lang.CharSequence)
to convey state changes to views within the user interface. While a live region may send different types of events generated by the view, state description will send AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED
events of type AccessibilityEvent.CONTENT_CHANGE_TYPE_STATE_DESCRIPTION
.
For notifying users about errors, such as in a login screen with text that displays an "incorrect password" notification, set AccessibilityNodeInfo.setError(CharSequence)
and dispatch an AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED
event with a change type of AccessibilityEvent.CONTENT_CHANGE_TYPE_ERROR
, instead. Some widgets may expose methods that convey error states to accessibility automatically, such as android.widget.TextView#setError(CharSequence)
, which manages these accessibility semantics and event dispatch for callers.
Parameters | |
---|---|
text |
CharSequence!: The announcement text. |
autofill
open fun autofill(values: SparseArray<AutofillValue!>): Unit
Automatically fills the content of the virtual children within this view.
Views with virtual children support the Autofill Framework mainly by:
- Providing the metadata defining what the virtual children mean and how they can be autofilled.
- Implementing the methods that autofill the virtual children.
onProvideAutofillVirtualStructure(android.view.ViewStructure,int)
is responsible for the former, this method is responsible for the latter - see autofill(android.view.autofill.AutofillValue)
and onProvideAutofillVirtualStructure(android.view.ViewStructure,int)
for more info about autofill.
If a child value is updated asynchronously, the next call to AutofillManager.notifyValueChanged(View, int, AutofillValue)
must happen after the value was changed to the autofilled value. If not, the child will not be considered autofilled.
Note: To indicate that a virtual view was autofilled, ?android:attr/autofilledHighlight
should be drawn over it until the data changes.
Parameters | |
---|---|
values |
SparseArray<AutofillValue!>: map of values to be autofilled, keyed by virtual child id. This value cannot be null . |
autofill
open fun autofill(value: AutofillValue!): Unit
Automatically fills the content of this view with the value
.
Views support the Autofill Framework mainly by:
- Providing the metadata defining what the view means and how it can be autofilled.
- Implementing the methods that autofill the view.
onProvideAutofillStructure(android.view.ViewStructure,int)
is responsible for the former, this method is responsible for latter.
This method does nothing by default, but when overridden it typically:
- Checks if the provided value matches the expected type (which is defined by
getAutofillType()
). - Checks if the view is editable - if it isn't, it should return right away.
- Call the proper getter method on
AutofillValue
to fetch the actual value. - Pass the actual value to the equivalent setter in the view.
For example, a text-field view could implement the method this way:
@Override public void autofill(AutofillValue value) { if (!value.isText() || !this.isEditable()) { return; } CharSequence text = value.getTextValue(); if (text != null) { this.setText(text); } }
If the value is updated asynchronously, the next call to AutofillManager.notifyValueChanged(View)
must happen after the value was changed to the autofilled value. If not, the view will not be considered autofilled.
Note: After this method is called, the value returned by getAutofillValue()
must be equal to the value
passed to it, otherwise the view will not be highlighted as autofilled.
Parameters | |
---|---|
value |
AutofillValue!: value to be autofilled. |
bringToFront
open fun bringToFront(): Unit
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 android.os.Build.VERSION_CODES#KITKAT
this method should be followed by calls to requestLayout()
and View.invalidate()
on the view's parent to force the parent to redraw with the new child ordering.
buildDrawingCache
open funbuildDrawingCache(): Unit
Deprecated: The view drawing cache was largely made obsolete with the introduction of hardware-accelerated rendering in API 11. With hardware-acceleration, intermediate cache layers are largely unnecessary and can easily result in a net loss in performance due to the cost of creating and updating the layer. In the rare cases where caching layers are useful, such as for alpha animations, setLayerType(int,android.graphics.Paint)
handles this with hardware rendering. For software-rendered snapshots of a small part of the View hierarchy or individual Views it is recommended to create a Canvas
from either a Bitmap
or android.graphics.Picture
and call draw(android.graphics.Canvas)
on the View. However these software-rendered usages are discouraged and have compatibility issues with hardware-only rendering features such as Config.HARDWARE
bitmaps, real-time shadows, and outline clipping. For screenshots of the UI for feedback reports or unit testing the PixelCopy
API is recommended.
Calling this method is equivalent to calling buildDrawingCache(false)
.
See Also
buildDrawingCache
open funbuildDrawingCache(autoScale: Boolean): Unit
Deprecated: The view drawing cache was largely made obsolete with the introduction of hardware-accelerated rendering in API 11. With hardware-acceleration, intermediate cache layers are largely unnecessary and can easily result in a net loss in performance due to the cost of creating and updating the layer. In the rare cases where caching layers are useful, such as for alpha animations, setLayerType(int,android.graphics.Paint)
handles this with hardware rendering. For software-rendered snapshots of a small part of the View hierarchy or individual Views it is recommended to create a Canvas
from either a Bitmap
or android.graphics.Picture
and call draw(android.graphics.Canvas)
on the View. However these software-rendered usages are discouraged and have compatibility issues with hardware-only rendering features such as Config.HARDWARE
bitmaps, real-time shadows, and outline clipping. For screenshots of the UI for feedback reports or unit testing the PixelCopy
API is recommended.
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.
See Also
buildLayer
open fun buildLayer(): Unit
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.
Exceptions | |
---|---|
java.lang.IllegalStateException |
If this view is not attached to a window |
callOnClick
open fun callOnClick(): Boolean
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.
Return | |
---|---|
Boolean |
True there was an assigned OnClickListener that was called, false otherwise is returned. |
canResolveLayoutDirection
open fun canResolveLayoutDirection(): Boolean
Check if layout direction resolution can be done.
Return | |
---|---|
Boolean |
true if layout direction resolution can be done otherwise return false. |
canResolveTextAlignment
open fun canResolveTextAlignment(): Boolean
Check if text alignment resolution can be done.
Return | |
---|---|
Boolean |
true if text alignment resolution can be done otherwise return false. |
canResolveTextDirection
open fun canResolveTextDirection(): Boolean
Check if text direction resolution can be done.
Return | |
---|---|
Boolean |
true if text direction resolution can be done otherwise return false. |
canScrollHorizontally
open fun canScrollHorizontally(direction: Int): Boolean
Check if this view can be scrolled horizontally in a certain direction.
This is without regard to whether the view is enabled or not, or if it will scroll in response to user input or not.
Parameters | |
---|---|
direction |
Int: Negative to check scrolling left, positive to check scrolling right. |
Return | |
---|---|
Boolean |
true if this view can be scrolled in the specified direction, false otherwise. |
canScrollVertically
open fun canScrollVertically(direction: Int): Boolean
Check if this view can be scrolled vertically in a certain direction.
This is without regard to whether the view is enabled or not, or if it will scroll in response to user input or not.
Parameters | |
---|---|
direction |
Int: Negative to check scrolling up, positive to check scrolling down. |
Return | |
---|---|
Boolean |
true if this view can be scrolled in the specified direction, false otherwise. |
cancelDragAndDrop
fun cancelDragAndDrop(): Unit
Cancels an ongoing drag and drop operation.
A android.view.DragEvent
object with android.view.DragEvent#getAction()
value of android.view.DragEvent#ACTION_DRAG_ENDED
and android.view.DragEvent#getResult()
value of false
will be sent to every View that received android.view.DragEvent#ACTION_DRAG_STARTED
even if they are not currently visible.
This method can be called on any View in the same window as the View on which startDragAndDrop
was called.
cancelLongPress
open fun cancelLongPress(): Unit
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.
cancelPendingInputEvents
fun cancelPendingInputEvents(): Unit
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.
checkInputConnectionProxy
open fun checkInputConnectionProxy(view: View!): Boolean
Called by the android.view.inputmethod.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.
Parameters | |
---|---|
view |
View!: The View that is making the InputMethodManager call. |
Return | |
---|---|
Boolean |
Return true to allow the call, false to reject. |
clearAnimation
open fun clearAnimation(): Unit
Cancels any animations for this view.
clearFocus
open fun clearFocus(): Unit
Called when this view wants to give up focus. If focus is cleared onFocusChanged(boolean,int,android.graphics.Rect)
is called.
Note: When not in touch-mode, the framework will try to give focus to the first focusable View from the top after focus is cleared. 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.
clearPendingCredentialRequest
open fun clearPendingCredentialRequest(): Unit
Clears the request and callback previously set through View.setPendingCredentialRequest
. Once this API is invoked, there will be no request fired to CredentialManager
on future view focus events.
See Also
clearViewTranslationCallback
open fun clearViewTranslationCallback(): Unit
Clear the ViewTranslationCallback
from this view.
combineMeasuredStates
open static fun combineMeasuredStates(
curState: Int,
newState: Int
): Int
Merge two states as returned by getMeasuredState()
.
Parameters | |
---|---|
curState |
Int: The current state as returned from a view or the result of combining multiple views. |
newState |
Int: The new view state to combine. |
Return | |
---|---|
Int |
Returns a new integer reflecting the combination of the two states. |
computeScroll
open fun computeScroll(): Unit
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.
computeSystemWindowInsets
open fun computeSystemWindowInsets(
in: WindowInsets!,
outLocalInsets: Rect!
): WindowInsets!
Compute insets that should be consumed by this view and the ones that should propagate to those under it.
Parameters | |
---|---|
in |
WindowInsets!: Insets currently being processed by this View, likely received as a parameter to onApplyWindowInsets(android.view.WindowInsets) . |
outLocalInsets |
Rect!: A Rect that will receive the insets that should be consumed by this view |
Return | |
---|---|
WindowInsets! |
Insets that should be passed along to views under this one |
createAccessibilityNodeInfo
open fun createAccessibilityNodeInfo(): AccessibilityNodeInfo!
Returns an AccessibilityNodeInfo
representing this view from the point of view of an android.accessibilityservice.AccessibilityService
. This method is responsible for obtaining an accessibility node info from a pool of reusable instances and calling onInitializeAccessibilityNodeInfo(android.view.accessibility.AccessibilityNodeInfo)
on this view to initialize the former.
Note: The client is responsible for recycling the obtained instance by calling AccessibilityNodeInfo.recycle()
to minimize object creation.
Return | |
---|---|
AccessibilityNodeInfo! |
A populated AccessibilityNodeInfo . |
createContextMenu
open fun createContextMenu(: ContextMenu!): Unit
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(android.view.ContextMenu)
or define an OnCreateContextMenuListener
to add items to the context menu.
Parameters | |
---|---|
menu |
ContextMenu!: The context menu to populate |
destroyDrawingCache
open fundestroyDrawingCache(): Unit
Deprecated: The view drawing cache was largely made obsolete with the introduction of hardware-accelerated rendering in API 11. With hardware-acceleration, intermediate cache layers are largely unnecessary and can easily result in a net loss in performance due to the cost of creating and updating the layer. In the rare cases where caching layers are useful, such as for alpha animations, setLayerType(int,android.graphics.Paint)
handles this with hardware rendering. For software-rendered snapshots of a small part of the View hierarchy or individual Views it is recommended to create a Canvas
from either a Bitmap
or android.graphics.Picture
and call draw(android.graphics.Canvas)
on the View. However these software-rendered usages are discouraged and have compatibility issues with hardware-only rendering features such as Config.HARDWARE
bitmaps, real-time shadows, and outline clipping. For screenshots of the UI for feedback reports or unit testing the PixelCopy
API is recommended.
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.
dispatchApplyWindowInsets
open fun dispatchApplyWindowInsets(insets: WindowInsets!): WindowInsets!
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(android.view.WindowInsets)
method or alternatively provide a OnApplyWindowInsetsListener
via the setOnApplyWindowInsetsListener
method.
This method replaces the older fitSystemWindows
method.
Parameters | |
---|---|
insets |
WindowInsets!: Insets to apply |
Return | |
---|---|
WindowInsets! |
The provided insets minus the insets that were consumed |
dispatchCapturedPointerEvent
open fun dispatchCapturedPointerEvent(event: MotionEvent!): Boolean
Pass a captured pointer event down to the focused view.
Parameters | |
---|---|
event |
MotionEvent!: The motion event to be dispatched. |
Return | |
---|---|
Boolean |
True if the event was handled by the view, false otherwise. |
dispatchConfigurationChanged
open fun dispatchConfigurationChanged(newConfig: Configuration!): Unit
Dispatch a notification about a resource configuration change down the view hierarchy. ViewGroups should override to route to their children.
Parameters | |
---|---|
newConfig |
Configuration!: The new resource configuration. |
dispatchCreateViewTranslationRequest
open fun dispatchCreateViewTranslationRequest(
viewIds: MutableMap<AutofillId!, LongArray!>,
supportedFormats: IntArray,
capability: TranslationCapability,
requests: MutableList<ViewTranslationRequest!>
): Unit
Dispatch to collect the ViewTranslationRequest
s for translation purpose by traversing the hierarchy when the app requests ui translation. Typically, this method should only be overridden by subclasses that provide a view hierarchy (such as ViewGroup
). Other classes should override View.onCreateViewTranslationRequest
for normal view or override View.onVirtualViewTranslationResponses
for view contains virtual children. When requested to start the ui translation, the system will call this method to traverse the view hierarchy to collect ViewTranslationRequest
s and create a android.view.translation.Translator
to translate the requests. All the ViewTranslationRequest
s must be added when the traversal is done.
The default implementation calls View.onCreateViewTranslationRequest
for normal view or calls View.onVirtualViewTranslationResponses
for view contains virtual children to build ViewTranslationRequest
if the view should be translated. The view is marked as having transient state
so that recycling of views doesn't prevent the system from attaching the response to it. Therefore, if overriding this method, you should set or reset the transient state.
Parameters | |
---|---|
viewIds |
MutableMap<AutofillId!, LongArray!>: a map for the view's AutofillId and its virtual child ids or null if the view doesn't have virtual child that should be translated. The virtual child ids are the same virtual ids provided by ContentCapture. |
supportedFormats |
IntArray: the supported translation formats. For now, the only possible value is the android.view.translation.TranslationSpec#DATA_FORMAT_TEXT . This value cannot be null . Value is android.view.translation.TranslationSpec#DATA_FORMAT_TEXT |
capability |
TranslationCapability: a TranslationCapability that holds translation capability. information, e.g. source spec, target spec. This value cannot be null . |
requests |
MutableList<ViewTranslationRequest!>: fill in with ViewTranslationRequest s for translation purpose. This value cannot be null . |
dispatchDisplayHint
open fun dispatchDisplayHint(hint: Int): Unit
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.
Parameters | |
---|---|
hint |
Int: A hint about whether or not this view is displayed: VISIBLE or INVISIBLE . Value is android.view.View#VISIBLE , android.view.View#INVISIBLE , or android.view.View#GONE |
dispatchDragEvent
open fun dispatchDragEvent(event: DragEvent!): Boolean
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 android.view.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.
dispatchDrawableHotspotChanged
open fun dispatchDrawableHotspotChanged(
x: Float,
y: Float
): Unit
Dispatches drawableHotspotChanged to all of this View's children.
Parameters | |
---|---|
x |
Float: hotspot x coordinate |
y |
Float: hotspot y coordinate |
dispatchFinishTemporaryDetach
open fun dispatchFinishTemporaryDetach(): Unit
Dispatch onFinishTemporaryDetach()
to this View and its direct children if this is a container View.
If you override this method you must call through to the superclass implementation.
dispatchGenericMotionEvent
open fun dispatchGenericMotionEvent(event: MotionEvent!): Boolean
Dispatch a generic motion event.
Generic motion events with source class InputDevice.SOURCE_CLASS_POINTER
are delivered to the view under the pointer. All other generic motion events are delivered to the focused view. Hover events are handled specially and are delivered to onHoverEvent(android.view.MotionEvent)
first.
Parameters | |
---|---|
event |
MotionEvent!: The motion event to be dispatched. |
Return | |
---|---|
Boolean |
True if the event was handled by the view, false otherwise. |
dispatchKeyEvent
open fun dispatchKeyEvent(event: KeyEvent!): Boolean
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.
Parameters | |
---|---|
event |
KeyEvent!: The key event to be dispatched. |
Return | |
---|---|
Boolean |
True if the event was handled, false otherwise. |
dispatchKeyEventPreIme
open fun dispatchKeyEventPreIme(event: KeyEvent!): Boolean
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.
Parameters | |
---|---|
event |
KeyEvent!: The key event to be dispatched. |
Return | |
---|---|
Boolean |
True if the event was handled, false otherwise. |
dispatchKeyShortcutEvent
open fun dispatchKeyShortcutEvent(event: KeyEvent!): Boolean
Dispatches a key shortcut event.
Parameters | |
---|---|
event |
KeyEvent!: The key event to be dispatched. |
Return | |
---|---|
Boolean |
True if the event was handled by the view, false otherwise. |
dispatchNestedFling
open fun dispatchNestedFling(
velocityX: Float,
velocityY: Float,
consumed: Boolean
): Boolean
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.
Parameters | |
---|---|
velocityX |
Float: Horizontal fling velocity in pixels per second |
velocityY |
Float: Vertical fling velocity in pixels per second |
consumed |
Boolean: true if the child consumed the fling, false otherwise |
Return | |
---|---|
Boolean |
true if the nested scrolling parent consumed or otherwise reacted to the fling |
dispatchNestedPreFling
open fun dispatchNestedPreFling(
velocityX: Float,
velocityY: Float
): Boolean
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:
- If a custom view is paged and needs to settle to a fixed page-point, do not call
dispatchNestedPreFling
; consume the fling and settle to a valid position regardless. - If a nested parent does consume the fling, this view should not scroll at all, even to settle back to a valid idle position.
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.
Parameters | |
---|---|
velocityX |
Float: Horizontal fling velocity in pixels per second |
velocityY |
Float: Vertical fling velocity in pixels per second |
Return | |
---|---|
Boolean |
true if a nested scrolling parent consumed the fling |
dispatchNestedPrePerformAccessibilityAction
open fun dispatchNestedPrePerformAccessibilityAction(
action: Int,
arguments: Bundle?
): Boolean
Report an accessibility action to this view's parents for delegated processing.
Implementations of performAccessibilityAction(int,android.os.Bundle)
may internally call this method to delegate an accessibility action to a supporting parent. If the parent returns true from its ViewParent.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.
Parameters | |
---|---|
action |
Int: Accessibility action to delegate |
arguments |
Bundle?: Optional action arguments This value may be null . |
Return | |
---|---|
Boolean |
true if the action was consumed by a parent |
dispatchNestedPreScroll
open fun dispatchNestedPreScroll(
dx: Int,
dy: Int,
consumed: IntArray?,
offsetInWindow: IntArray?
): Boolean
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.
Parameters | |
---|---|
dx |
Int: Horizontal scroll distance in pixels |
dy |
Int: Vertical scroll distance in pixels |
consumed |
IntArray?: Output. If not null, consumed[0] will contain the consumed component of dx and consumed[1] the consumed dy. |
offsetInWindow |
IntArray?: 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. |
Return | |
---|---|
Boolean |
true if the parent consumed some or all of the scroll delta |
dispatchNestedScroll
open fun dispatchNestedScroll(
dxConsumed: Int,
dyConsumed: Int,
dxUnconsumed: Int,
dyUnconsumed: Int,
offsetInWindow: IntArray?
): Boolean
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.
Parameters | |
---|---|
dxConsumed |
Int: Horizontal distance in pixels consumed by this view during this scroll step |
dyConsumed |
Int: Vertical distance in pixels consumed by this view during this scroll step |
dxUnconsumed |
Int: Horizontal scroll distance in pixels not consumed by this view |
dyUnconsumed |
Int: Horizontal scroll distance in pixels not consumed by this view |
offsetInWindow |
IntArray?: 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. |
Return | |
---|---|
Boolean |
true if the event was dispatched, false if it could not be dispatched. |
dispatchPointerCaptureChanged
open fun dispatchPointerCaptureChanged(hasCapture: Boolean): Unit
See Also
dispatchPopulateAccessibilityEvent
open fun dispatchPopulateAccessibilityEvent(event: AccessibilityEvent!): Boolean
Dispatches an AccessibilityEvent
to the View
to add the text content of the view and its children.
Note: This method should only be used with event.setText(). Avoid mutating other event state in this method. In general, put UI metadata in the node for services to easily query.
- If you are modifying other event properties, you may be eliminating semantics accessibility services may want. Instead, send a separate event using
sendAccessibilityEvent(int)
and overrideonInitializeAccessibilityEvent(android.view.accessibility.AccessibilityEvent)
. - If you are checking for type
AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED
to generate window/title announcements, you may be causing disruptive announcements (or making no announcements at all). Instead, follow the practices described inView.announceForAccessibility(CharSequence)
. Note: this does not suggest calling announceForAccessibility(), but using the suggestions listed in its documentation. - If you are making changes based on the state of accessibility, such as checking for an event type to trigger a UI update, while well-intentioned, you are creating brittle, less well-maintained code that works for some users but not others. Instead, leverage existing code for equitable experiences and less technical debt. See
AccessibilityManager.isEnabled()
for an example.
Note that the event text is populated in a separate dispatch path (onPopulateAccessibilityEvent(android.view.accessibility.AccessibilityEvent)
) 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(android.view.accessibility.AccessibilityEvent)
on this view and then call the dispatchPopulateAccessibilityEvent(android.view.accessibility.AccessibilityEvent)
on each child or the first child that is visible. Override this method if custom population of the event text content is required.
If an AccessibilityDelegate
has been specified via calling setAccessibilityDelegate(android.view.View.AccessibilityDelegate)
its AccessibilityDelegate.dispatchPopulateAccessibilityEvent(View, AccessibilityEvent)
is responsible for handling this call.
If this view sets isAccessibilityDataSensitive()
then this view should only append sensitive information to an event that also sets AccessibilityEvent.isAccessibilityDataSensitive()
.
Note: Accessibility events of certain types are not dispatched for populating the event text via this method. For details refer to AccessibilityEvent
.
Parameters | |
---|---|
event |
AccessibilityEvent!: The event. |
Return | |
---|---|
Boolean |
True if the event population was completed. |
dispatchProvideAutofillStructure
open fun dispatchProvideAutofillStructure(
structure: ViewStructure,
flags: Int
): Unit
Dispatches creation of a ViewStructure
s for autofill purposes down the hierarchy, when an Assist structure is being created as part of an autofill request.
The default implementation does the following:
- Sets the
AutofillId
in the structure. - Calls
onProvideAutofillStructure(android.view.ViewStructure,int)
. - Calls
onProvideAutofillVirtualStructure(android.view.ViewStructure,int)
.
Typically, this method should only be overridden by subclasses that provide a view hierarchy (such as ViewGroup
) - other classes should override onProvideAutofillStructure(android.view.ViewStructure,int)
or onProvideAutofillVirtualStructure(android.view.ViewStructure,int)
instead.
When overridden, it must:
- Either call
super.dispatchProvideAutofillStructure(structure, flags)
or explicitly set theAutofillId
in the structure (for example, by callingstructure.setAutofillId(getAutofillId())
). - Decide how to handle the
AUTOFILL_FLAG_INCLUDE_NOT_IMPORTANT_VIEWS
flag - when set, all views in the structure should be considered important for autofill, regardless of whatisImportantForAutofill()
returns. We encourage you to respect this flag to provide a better user experience - this flag is typically used when an user explicitly requested autofill. If the flag is not set, then only views marked as important for autofill should be included in the structure - skipping non-important views optimizes the overall autofill performance.
Parameters | |
---|---|
structure |
ViewStructure: fill in with structured view data for autofill purposes. This value cannot be null . |
flags |
Int: optional flags. Value is either 0 or android.view.View#AUTOFILL_FLAG_INCLUDE_NOT_IMPORTANT_VIEWS |
dispatchProvideStructure
open fun dispatchProvideStructure(structure: ViewStructure!): Unit
Dispatch creation of ViewStructure
down the hierarchy. The default implementation calls onProvideStructure
and onProvideVirtualStructure
.
dispatchScrollCaptureSearch
open fun dispatchScrollCaptureSearch(
localVisibleRect: Rect,
windowOffset: Point,
targets: Consumer<ScrollCaptureTarget!>
): Unit
Dispatch a scroll capture search request down the view hierarchy.
Parameters | |
---|---|
localVisibleRect |
Rect: the visible area of this ViewGroup in local coordinates, according to the parent This value cannot be null . |
windowOffset |
Point: the offset of this view within the window This value cannot be null . |
targets |
Consumer<ScrollCaptureTarget!>: accepts potential scroll capture targets; results.accept may be called zero or more times on the calling thread before onScrollCaptureSearch returns This value cannot be null . |
dispatchStartTemporaryDetach
open fun dispatchStartTemporaryDetach(): Unit
Dispatch onStartTemporaryDetach()
to this View and its direct children if this is a container View.
If you override this method you must call through to the superclass implementation.
dispatchSystemUiVisibilityChanged
open fundispatchSystemUiVisibilityChanged(visibility: Int): Unit
Deprecated: Use WindowInsets.isVisible(int)
to find out about system bar visibilities by setting a OnApplyWindowInsetsListener
on this view.
Dispatch callbacks to setOnSystemUiVisibilityChangeListener
down the view hierarchy.
dispatchTouchEvent
open fun dispatchTouchEvent(event: MotionEvent!): Boolean
Pass the touch screen motion event down to the target view, or this view if it is the target.
Parameters | |
---|---|
event |
MotionEvent!: The motion event to be dispatched. |
Return | |
---|---|
Boolean |
True if the event was handled by the view, false otherwise. |
See Also
dispatchTrackballEvent
open fun dispatchTrackballEvent(event: MotionEvent!): Boolean
Pass a trackball motion event down to the focused view.
Parameters | |
---|---|
event |
MotionEvent!: The motion event to be dispatched. |
Return | |
---|---|
Boolean |
True if the event was handled by the view, false otherwise. |
See Also
dispatchUnhandledMove
open fun dispatchUnhandledMove(
focused: View!,
direction: Int
): Boolean
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.
Parameters | |
---|---|
focused |
View!: The currently focused view. |
direction |
Int: The direction focus wants to move. One of FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, and FOCUS_RIGHT. Value is android.view.View#FOCUS_LEFT , android.view.View#FOCUS_UP , android.view.View#FOCUS_RIGHT , or android.view.View#FOCUS_DOWN |
Return | |
---|---|
Boolean |
True if the this view consumed this unhandled move. |
dispatchWindowFocusChanged
open fun dispatchWindowFocusChanged(hasFocus: Boolean): Unit
Called when the window containing this view gains or loses window focus. ViewGroups should override to route to their children.
Parameters | |
---|---|
hasFocus |
Boolean: True if the window containing this view now has focus, false otherwise. |
dispatchWindowInsetsAnimationEnd
open fun dispatchWindowInsetsAnimationEnd(animation: WindowInsetsAnimation): Unit
Dispatches WindowInsetsAnimation.Callback.onEnd(WindowInsetsAnimation)
when Window Insets animation ends.
Parameters | |
---|---|
animation |
WindowInsetsAnimation: The current ongoing WindowInsetsAnimation . This value cannot be null . |
dispatchWindowInsetsAnimationPrepare
open fun dispatchWindowInsetsAnimationPrepare(animation: WindowInsetsAnimation): Unit
Dispatches WindowInsetsAnimation.Callback.onPrepare(WindowInsetsAnimation)
when Window Insets animation is being prepared.
Parameters | |
---|---|
animation |
WindowInsetsAnimation: current animation This value cannot be null . |
dispatchWindowInsetsAnimationProgress
open fun dispatchWindowInsetsAnimationProgress(
insets: WindowInsets,
runningAnimations: MutableList<WindowInsetsAnimation!>
): WindowInsets
Dispatches WindowInsetsAnimation.Callback.onProgress(WindowInsets, List)
when Window Insets animation makes progress.
Parameters | |
---|---|
insets |
WindowInsets: The current WindowInsets . This value cannot be null . |
runningAnimations |
MutableList<WindowInsetsAnimation!>: The currently running WindowInsetsAnimation s. This value cannot be null . |
Return | |
---|---|
WindowInsets |
current WindowInsets . This value cannot be null . |
dispatchWindowInsetsAnimationStart
open fun dispatchWindowInsetsAnimationStart(
animation: WindowInsetsAnimation,
bounds: WindowInsetsAnimation.Bounds
): WindowInsetsAnimation.Bounds
Dispatches WindowInsetsAnimation.Callback.onStart(WindowInsetsAnimation, Bounds)
when Window Insets animation is started.
Parameters | |
---|---|
animation |
WindowInsetsAnimation: current animation This value cannot be null . |
bounds |
WindowInsetsAnimation.Bounds: the upper and lower Bounds that provides range of WindowInsetsAnimation . This value cannot be null . |
Return | |
---|---|
WindowInsetsAnimation.Bounds |
the upper and lower Bounds . This value cannot be null . |
dispatchWindowSystemUiVisiblityChanged
open fundispatchWindowSystemUiVisiblityChanged(visible: Int): Unit
Deprecated: SystemUiVisibility flags are deprecated. Use WindowInsetsController
instead.
Dispatch callbacks to onWindowSystemUiVisibilityChanged(int)
down the view hierarchy.
dispatchWindowVisibilityChanged
open fun dispatchWindowVisibilityChanged(visibility: Int): Unit
Dispatch a window visibility change down the view hierarchy. ViewGroups should override to route to their children.
Parameters | |
---|---|
visibility |
Int: The new visibility of the window. Value is android.view.View#VISIBLE , android.view.View#INVISIBLE , or android.view.View#GONE |
See Also
draw
open fun draw(canvas: Canvas): Unit
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.
If you override this method you must call through to the superclass implementation.
Parameters | |
---|---|
canvas |
Canvas: The Canvas to which the View is rendered. This value cannot be null . |
drawableHotspotChanged
open fun drawableHotspotChanged(
x: Float,
y: Float
): Unit
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.
If you override this method you must call through to the superclass implementation.
Parameters | |
---|---|
x |
Float: hotspot x coordinate |
y |
Float: hotspot y coordinate |
findFocus
open fun findFocus(): View!
Find the view in the hierarchy rooted at this view that currently has focus.
Return | |
---|---|
View! |
The view that currently has focus, or null if no focused view can be found. |
findOnBackInvokedDispatcher
fun findOnBackInvokedDispatcher(): OnBackInvokedDispatcher?
Walk up the View hierarchy to find the nearest OnBackInvokedDispatcher
.
Return | |
---|---|
OnBackInvokedDispatcher? |
The OnBackInvokedDispatcher from this or the nearest ancestor, or null if this view is both not attached and have no ancestor providing an OnBackInvokedDispatcher . |
findViewById
fun <T : View!> findViewById(id: Int): T
Finds the first descendant view with the given ID, the view itself if the ID matches getId()
, or null
if the ID is invalid (< 0) or there is no matching view in the hierarchy.
Note: In most cases -- depending on compiler support -- the resulting view is automatically cast to the target class type. If the target class type is unconstrained, an explicit cast may be necessary.
Parameters | |
---|---|
id |
Int: the ID to search for |
Return | |
---|---|
T |
a view with given ID if found, or null otherwise |
findViewWithTag
fun <T : View!> findViewWithTag(tag: Any!): T
Look for a child view with the given tag. If this view has the given tag, return this view.
Parameters | |
---|---|
tag |
Any!: The tag to search for, using "tag.equals(getTag())". |
Return | |
---|---|
T |
The View that has the given tag in the hierarchy or null |
findViewsWithText
open fun findViewsWithText(
outViews: ArrayList<View!>!,
searched: CharSequence!,
flags: Int
): Unit
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.
Parameters | |
---|---|
outViews |
ArrayList<View!>!: The output list of matching Views. |
searched |
CharSequence!: The text to match against. |
flags |
Int: Value is either 0 or a combination of android.view.View#FIND_VIEWS_WITH_TEXT , and android.view.View#FIND_VIEWS_WITH_CONTENT_DESCRIPTION |
focusSearch
open fun focusSearch(direction: Int): View!
Find the nearest view in the specified direction that can take focus. This does not actually give focus to that view.
Parameters | |
---|---|
direction |
Int: One of FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, and FOCUS_RIGHT Value is android.view.View#FOCUS_LEFT , android.view.View#FOCUS_UP , android.view.View#FOCUS_RIGHT , or android.view.View#FOCUS_DOWN |
Return | |
---|---|
View! |
The nearest focusable in the specified direction, or null if none can be found. |
forceHasOverlappingRendering
open fun forceHasOverlappingRendering(hasOverlappingRendering: Boolean): Unit
Sets the behavior for overlapping rendering for this view (see hasOverlappingRendering()
for more details on this behavior). Calling this method is an alternative to overriding hasOverlappingRendering()
in a subclass, providing the value which is then used internally. That is, when forceHasOverlappingRendering(boolean)
is called, the value of hasOverlappingRendering()
is ignored and the value passed into this method is used instead.
Parameters | |
---|---|
hasOverlappingRendering |
Boolean: The value for overlapping rendering to be used internally instead of that returned by hasOverlappingRendering() . |
forceLayout
open fun forceLayout(): Unit
Forces this view to be laid out during the next layout pass. This method does not call requestLayout() or forceLayout() on the parent.
gatherTransparentRegion
open fun gatherTransparentRegion(region: Region?): Boolean
This is used by the ViewRoot to perform an optimization when the view hierarchy contains one or several SurfaceView. SurfaceView is always considered transparent, but its children are not, therefore all View objects remove themselves from the global transparent region (passed as a parameter to this function).
Parameters | |
---|---|
region |
Region?: The transparent region for this ViewAncestor (window). This value may be null . |
Return | |
---|---|
Boolean |
Returns true if the effective visibility of the view at this point is opaque, regardless of the transparent region; returns false if it is possible for underlying windows to be seen behind the view. |