Android Guides | Samples

Android.Views.View Class

Developer Guides

For information about using this class to develop your application's user interface, read the User Interface developer guide.

See Also: View

Syntax

[Android.Runtime.Register("android/view/View", DoNotGenerateAcw=true)]
public class View : Object, Drawable+ICallback, IAccessibilityEventSource, KeyEvent+ICallback, IDisposable

Remarks

Developer Guides

For information about using this class to develop your application's user interface, read the User Interface developer guide.

Using Views

Implementing a Custom View

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.

    xml Example

     <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

    java Example

          Button myButton = (Button) findViewById(R.id.my_button);

Position

Size, padding and margins

Layout

Drawing

Event Handling and Threading

Focus Handling

Touch Mode

Scrolling

Tags

Properties

Animation

Security

This class represents the basic building block for user interface components. A View occupies a rectangular area on the screen and is responsible for drawing and event handling. View is the base class for widgets, which are used to create interactive UI components (buttons, text fields, etc.). The ViewGroup subclass is the base class for layouts, which are invisible containers that hold other Views (or other ViewGroups) and define their layout properties.

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 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 handled moving focus in response to user input. To force focus to a specific view, call View.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 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 View.Visibility.

Note: The Android framework is responsible for measuring, laying out and drawing views. You should not call methods that perform these actions on views yourself unless you are actually implementing a ViewGroup.

To implement a custom view, you will usually begin by providing overrides for some of the standard methods that the framework calls on all views. You do not need to override all of these methods. In fact, you can start by just overriding View.OnDraw(Canvas).

CategoryMethodsDescription
CreationConstructorsThere 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.
View.OnFinishInflateCalled after a view and all of its children has been inflated from XML.
LayoutView.OnMeasure(Int32,Int32)Called to determine the size requirements for this view and all of its children.
View.OnLayout(Boolean,Int32,Int32,Int32,Int32)Called when this view should assign a size and position to all of its children.
View.OnSizeChanged(Int32,Int32,Int32,Int32)Called when the size of this view has changed.
DrawingView.OnDraw(Canvas)Called when the view should render its content.
Event processingView.OnKeyDown(Keycode,KeyEvent)Called when a new hardware key event occurs.
View.OnKeyUp(Keycode,KeyEvent)Called when a hardware key up event occurs.
View.OnTrackballEvent(MotionEvent)Called when a trackball motion event occurs.
View.OnTouchEvent(MotionEvent)Called when a touch screen motion event occurs.
FocusView.OnFocusChanged(Boolean,FocusSearchDirection,FocusSearchDirection)Called when the view gains or loses focus.
View.OnWindowFocusChanged(Boolean)Called when the window containing the view gains or loses focus.
AttachingView.OnAttachedToWindowCalled when the view is attached to a window.
View.OnDetachedFromWindowCalled when the view is detached from its window.
View.OnWindowVisibilityChanged(ViewStates)Called when the visibility of the window containing the view has changed.

View IDs need not be unique throughout the tree, but it is good practice to ensure that they are at least unique within the part of the tree you are searching.

The geometry of a view is that of a rectangle. A view has a location, expressed as a pair of left and top coordinates, and two dimensions, expressed as a width and a height. The unit for location and dimensions is the pixel.

It is possible to retrieve the location of a view by invoking the methods View.Left and View.Top. 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 View.Right and View.Bottom. These methods return the coordinates of the right and bottom edges of the rectangle representing the view. For instance, calling View.Right is similar to the following computation: getLeft() + getWidth() (see for more information about the width.)

The size of a view is expressed with a width and a height. A view actually possess two pairs of width and height values.

The first pair is known as measured width and measured height. These dimensions define how big a view wants to be within its parent (see for more details.) The measured dimensions can be obtained by calling View.MeasuredWidth and View.MeasuredHeight.

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 View.Width and View.Height.

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 View.SetPadding(Int32,Int32,Int32,Int32) or View.SetPaddingRelative(Int32,Int32,Int32,Int32) method and queried by calling View.PaddingLeft, View.PaddingTop, View.PaddingRight, View.PaddingBottom, View.PaddingStart, View.PaddingEnd.

Even though a view can define a padding, it does not provide any support for margins. However, view groups provide such a support. Refer to ViewGroup and NoType:android/view/ViewGroup$MarginLayoutParams;Href=../../../reference/android/view/ViewGroup.MarginLayoutParams.html for further information.

Layout is a two pass process: a measure pass and a layout pass. The measuring pass is implemented in View.Measure(Int32,Int32) 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 View.Layout(Int32,Int32,Int32,Int32) 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 View.MeasuredWidth and View.MeasuredHeight 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 NoType:android/view/View$MeasureSpec;Href=../../../reference/android/view/View.MeasureSpec.html 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).
There are subclasses of LayoutParams for different subclasses of ViewGroup. For example, AbsoluteLayout has its own subclass of LayoutParams which adds an X and Y value.

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 View.RequestLayout. This method is typically called by a view on itself when it believes that is can no longer fit within its current bounds.

Drawing is handled by walking the tree and recording the drawing commands of any View that needs to update. After this, the drawing commands of the entire tree are issued to screen, clipped to the newly damaged area.

The tree is largely recorded and drawn in order, with parents drawn before (i.e., behind) their children, with siblings drawn in the order they appear in the tree. If you set a background drawable for a View, then the View will draw it before calling back to its onDraw() method. The child drawing order can be overridden with ViewGroup.ChildrenDrawingOrderEnabled in a ViewGroup, and with View.SetZ(Single) custom Z values} set on Views.

To force a view to draw, call View.Invalidate.

The basic cycle of a view is as follows:

  1. An event comes in and is dispatched to the appropriate view. The view handles the event and notifies any listeners.
  2. If in the course of processing the event, the view's bounds may need to be changed, the view will call View.RequestLayout.
  3. Similarly, if in the course of processing the event the view's appearance may need to be changed, the view will call View.Invalidate.
  4. If either View.RequestLayout or View.Invalidate were called, the framework will take care of measuring, laying out, and drawing the tree as appropriate.

Note: The entire view tree is single threaded. You must always be on the UI thread when calling any method on any view. If you are doing work on other threads and want to update the state of a view from that thread, you should use a Handler.

The framework will handle routine focus movement in response to user input. This includes changing the focus as views are removed or hidden, or as new views become available. Views indicate their willingness to take focus through the View.Focusable method. To change whether a view can take focus, call View.Focusable. When in touch mode (see notes below) views indicate whether they still would like focus via View.FocusableInTouchMode and can change this via View.FocusableInTouchMode.

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:

java Example

 nextFocusDown
 nextFocusLeft
 nextFocusRight
 nextFocusUp

To get a particular view to take focus, call View.RequestFocus.

When a user is navigating a user interface via directional keys such as a D-pad, it is necessary to give focus to actionable items such as buttons so the user can see what will take input. If the device has touch capabilities, however, and the user begins interacting with the interface by touching it, it is no longer necessary to always highlight, or give focus to, a particular view. This motivates a mode for interaction named 'touch mode'.

For a touch capable device, once the user touches the screen, the device will enter touch mode. From this point onward, only views for which View.FocusableInTouchMode 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 Activitys. Call View.IsInTouchMode to see whether the device is currently in touch mode.

The framework provides basic support for views that wish to internally scroll their content. This includes keeping track of the X and Y scroll offset as well as mechanisms for drawing scrollbars. See View.ScrollBy(Int32,Int32), View.ScrollTo(Int32,Int32), and View.AwakenScrollBars for more details.

Unlike IDs, tags are not used to identify views. Tags are essentially an extra piece of information that can be associated with a view. They are most often used as a convenience to store data related to views in the views themselves rather than by putting them in a separate structure.

The View class exposes an View.ALPHA property, as well as several transform-related properties, such as View.TRANSLATION_X and View.TRANSLATION_Y. These properties are available both in the Property form as well as in similarly-named setter/getter methods (such as View.Alpha for View.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 section.

Starting with Android 3.0, the preferred way of animating views is to use the Android.Animation package APIs. These Animator-based classes change actual properties of the View object, such as View.Alpha and View.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 View.Animation or View.StartAnimation(Animation). The animation can alter the scale, rotation, translation and alpha of a view over time. If the animation is attached to a view that has children, the animation will affect the entire subtree rooted by that node. When an animation is started, the framework will take care of redrawing the appropriate views until the animation completes.

Sometimes it is essential that an application be able to verify that an action is being performed with the full knowledge and consent of the user, such as granting a permission request, making a purchase or clicking on an advertisement. Unfortunately, a malicious application could try to spoof the user into performing these actions, unaware, by concealing the intended purpose of the view. As a remedy, the framework offers a touch filtering mechanism that can be used to improve the security of views that provide access to sensitive functionality.

To enable touch filtering, call View.FilterTouchesWhenObscured or set the android:filterTouchesWhenObscured layout attribute to true. When enabled, the framework will discard touches that are received whenever the view's window is obscured by another visible window. As a result, the view will not receive touches whenever a toast, dialog or other window appears above the view's window.

For more fine-grained control over security, consider overriding the View.OnFilterTouchEventForSecurity(MotionEvent) method to implement your own security policy. See also MotionEvent.FlagWindowIsObscured.

See Also

[Android Documentation]

Requirements

Namespace: Android.Views
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1

The members of Android.Views.View are listed below.

See Also: Object

Public Constructors

Simple constructor to use when creating a view from code.
Constructor that is called when inflating a view from XML.
Perform inflation from XML and apply a class-specific base style from a theme attribute.
Perform inflation from XML and apply a class-specific base style from a theme attribute or style resource.

Protected Constructors

A constructor used when creating managed representations of JNI objects; called by the runtime.

Public Fields

const
AccessibilityLiveRegionAssertiveAccessibilityLiveRegion (2). Live region mode specifying that accessibility services should interrupt ongoing speech to immediately announce changes to this view.
const
AccessibilityLiveRegionNoneAccessibilityLiveRegion (0). Live region mode specifying that accessibility services should not automatically announce changes to this view.
const
AccessibilityLiveRegionPoliteAccessibilityLiveRegion (1). Live region mode specifying that accessibility services should announce changes to this view.
const
FindViewsWithContentDescriptionFindViewsWith (2). Find find views that contain the specified content description.
const
ImportantForAccessibilityAutoImportantForAccessibility (0). Automatically determine whether a view is important for accessibility.
const
ImportantForAccessibilityNoImportantForAccessibility (2). The view is not important for accessibility.
const
ImportantForAccessibilityNoHideDescendantsImportantForAccessibility (4). The view is not important for accessibility, nor are any of its descendant views.
const
ImportantForAccessibilityYesImportantForAccessibility (1). The view is important for accessibility.
const
LayoutDirectionInheritLayoutDirection (2). Horizontal layout direction of this view is inherited from its parent.
const
LayoutDirectionLocaleLayoutDirection (3). Horizontal layout direction of this view is from deduced from the default language script for the locale.
const
LayoutDirectionLtrLayoutDirection (0). Horizontal layout direction of this view is from Left to Right.
const
LayoutDirectionRtlLayoutDirection (1). Horizontal layout direction of this view is from Right to Left.
const
MeasuredHeightStateShiftInt32 (16). Bit shift of View.MeasuredStateMask to get to the height bits for functions that combine both width and height into a single int, such as View.MeasuredState and the childState argument of View.ResolveSizeAndState(Int32,Int32,Int32).
const
MeasuredSizeMaskInt32 (16777215). Bits of View.MeasuredWidthAndState and View.MeasuredWidthAndState that provide the actual measured size.
const
MeasuredStateMaskInt32 (-16777216). Bits of View.MeasuredWidthAndState and View.MeasuredWidthAndState that provide the additional state bits.
const
MeasuredStateTooSmallInt32 (16777216). Bit of View.MeasuredWidthAndState and View.MeasuredWidthAndState that indicates the measured size is smaller that the space the view would like to have.
const
NoIdInt32 (-1). Used to mark a View that has no ID.
const
OverScrollAlwaysOverScrollMode (0). Always allow a user to over-scroll this view, provided it is a view that can scroll.
const
OverScrollIfContentScrollsOverScrollMode (1). 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.
const
OverScrollNeverOverScrollMode (2). Never allow a user to over-scroll this view.
const
ScreenStateOffScreenState (0). Indicates that the screen has changed state and is now off.
const
ScreenStateOnScreenState (1). Indicates that the screen has changed state and is now on.
const
ScrollAxisHorizontalScrollAxis (1). Indicates scrolling along the horizontal axis.
const
ScrollAxisNoneScrollAxis (0). Indicates no axis of view scrolling.
const
ScrollAxisVerticalScrollAxis (2). Indicates scrolling along the vertical axis.
const
SystemUiFlagFullscreenSystemUiFlags (4). Flag for View.SystemUiVisibility: 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.
const
SystemUiFlagHideNavigationSystemUiFlags (2). Flag for View.SystemUiVisibility: View has requested that the system navigation be temporarily hidden.
const
SystemUiFlagImmersiveSystemUiFlags (2048). Flag for View.SystemUiVisibility: View would like to remain interactive when hiding the navigation bar with View.SystemUiFlagHideNavigation.
const
SystemUiFlagImmersiveStickySystemUiFlags (4096). Flag for View.SystemUiVisibility: View would like to remain interactive when hiding the status bar with View.SystemUiFlagFullscreen and/or hiding the navigation bar with View.SystemUiFlagHideNavigation.
const
SystemUiFlagLayoutFullscreenSystemUiFlags (1024). Flag for View.SystemUiVisibility: View would like its window to be laid out as if it has requested View.SystemUiFlagFullscreen, even if it currently hasn't.
const
SystemUiFlagLayoutHideNavigationSystemUiFlags (512). Flag for View.SystemUiVisibility: View would like its window to be laid out as if it has requested View.SystemUiFlagHideNavigation, even if it currently hasn't.
const
SystemUiFlagLayoutStableSystemUiFlags (256). Flag for View.SystemUiVisibility: When using other layout flags, we would like a stable view of the content insets given to View.FitSystemWindows(Rect).
const
SystemUiFlagLowProfileSystemUiFlags (1). Flag for View.SystemUiVisibility: View has requested the system UI to enter an unobtrusive "low profile" mode.
const
SystemUiFlagVisibleSystemUiFlags (0). Special constant for View.SystemUiVisibility: View has requested the system UI (status bar) to be visible (the default).
const
SystemUiLayoutFlagsSystemUiFlags (1536). Flags that can impact the layout in relation to system UI.
const
TextAlignmentCenterTextAlignment (4). Center the paragraph, e.g.
const
TextAlignmentGravityTextAlignment (1). Default for the root view.
const
TextAlignmentInheritTextAlignment (0). Default text alignment.
const
TextAlignmentResolvedDefaultInt32 (131072).
const
TextAlignmentTextEndTextAlignment (3). Align to the end of the paragraph, e.g.
const
TextAlignmentTextStartTextAlignment (2). Align to the start of the paragraph, e.g.
const
TextAlignmentViewEndTextAlignment (6). Align to the end of the view, which is ALIGN_RIGHT if the view’s resolved layoutDirection is LTR, and ALIGN_LEFT otherwise.
const
TextAlignmentViewStartTextAlignment (5). Align to the start of the view, which is ALIGN_LEFT if the view’s resolved layoutDirection is LTR, and ALIGN_RIGHT otherwise.
const
TextDirectionAnyRtlTextDirection (2). Text direction is using "any-RTL" algorithm.
const
TextDirectionFirstStrongTextDirection (1). Text direction is using "first strong algorithm".
const
TextDirectionInheritTextDirection (0). Text direction is inherited through ViewGroup
const
TextDirectionLocaleTextDirection (5). Text direction is coming from the system Locale.
const
TextDirectionLtrTextDirection (3). Text direction is forced to LTR.
const
TextDirectionRtlTextDirection (4). Text direction is forced to RTL.

Protected Fields

const
ViewLogTagString. The logging tag used by this class with android.util.

Public Properties

AccessibilityLiveRegionAccessibilityLiveRegion. Gets the live region mode for this View.
[read-only]
AccessibilityNodeProviderAccessibilityNodeProvider. Gets the provider for managing a virtual view hierarchy rooted at this View and reported to AccessibilityServices that explore the window content.
ActivatedBoolean. Indicates the activation state of this view.
AlphaSingle. The opacity of the view.
AnimationAnimation. Get the animation currently associated with this view.
[read-only]
ApplicationWindowTokenIBinder. Retrieve a unique token identifying the top-level "real" window of the window that this view is attached to.
ApplyWindowInsetsView+ApplyWindowInsetsHandler.
BackgroundDrawable. Gets the background drawable
BackgroundTintListColorStateList. Return the tint applied to the background drawable, if specified.
BackgroundTintModePorterDuff+Mode. Return the blending mode used to apply the tint to the background drawable, if specified.
[read-only]
BaselineInt32.
BottomInt32. Bottom position of this view relative to its parent.
[read-only]
CameraDistanceSingle. Gets the distance along the Z axis from the camera to this view.
ClickableBoolean. Indicates whether this view reacts to click events or not.
ClipBoundsRect. Returns a copy of the current View.ClipBounds.
ClipToOutlineBoolean. Returns whether the Outline should be used to clip the contents of the View.
ContentDescriptionString.
ContentDescriptionFormattedICharSequence. Gets the View description.
[read-only]
ContextContext. Returns the context the view is running in, through which it can access the current theme, resources, etc.
[read-only]
DisplayDisplay. Gets the logical display to which the view's window has been attached.
[read-only]
DrawingCacheBitmap.
DrawingCacheBackgroundColorColor.
DrawingCacheEnabledBoolean.
DrawingCacheQualityDrawingCacheQuality. Returns the quality of the drawing cache.
[read-only]
DrawingTimeInt64.
DuplicateParentStateEnabledBoolean.
ElevationSingle. The base elevation of this view relative to its parent, in pixels.
EnabledBoolean. Returns the enabled status for this view.
FilterTouchesWhenObscuredBoolean. Gets whether the framework should discard touches when the view's window is obscured by another visible window.
[read-only]
FitsSystemWindowsBoolean. Check for state of View.SetFitsSystemWindows(Boolean).
FocusableBoolean. Returns whether this View is able to take focus.
FocusableInTouchModeBoolean. When a view is focusable, it may not want to take focus when in touch mode.
[read-only]
HandlerHandler.
HapticFeedbackEnabledBoolean.
[read-only]
HasFocusBoolean. Returns true if this view has focus itself, or is the ancestor of the view that has focus.
[read-only]
HasFocusableBoolean. Returns true if this view is focusable or if it contains a reachable View for which View.HasFocusable returns true.
[read-only]
HasNestedScrollingParentBoolean. Returns true if this view has a nested scrolling parent.
[read-only]
HasOnClickListenersBoolean. Return whether this view has an attached OnClickListener.
[read-only]
HasOverlappingRenderingBoolean. Returns whether this View has content which overlaps.
HasTransientStateBoolean. 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.
[read-only]
HasWindowFocusBoolean. Returns true if this view is in a window that currently has window focus.
[read-only]
HeightInt32. Return the height of your view.
HorizontalFadingEdgeEnabledBoolean.
[read-only]
HorizontalFadingEdgeLengthInt32. Returns the size of the horizontal faded edges used to indicate that more content in this view is visible.
HorizontalScrollBarEnabledBoolean.
HoveredBoolean. Returns true if the view is currently hovered.
IdInt32. Returns this view's identifier.
ImportantForAccessibilityImportantForAccessibility. Gets the mode for determining whether this View is important for accessibility which is if it fires accessibility events and if it is reported to accessibility services that query the screen.
[read-only]
IsAccessibilityFocusedBoolean. Returns whether this View is accessibility focused.
[read-only]
IsAttachedToWindowBoolean. Returns true if this view is currently attached to a window.
[read-only]
IsDirtyBoolean. True if this view has changed since the last time being drawn.
[read-only]
IsFocusedBoolean. Returns true if this view has focus
[read-only]
IsHardwareAcceleratedBoolean.
[read-only]
IsImportantForAccessibilityBoolean. Computes whether this view should be exposed for accessibility.
[read-only]
IsInEditModeBoolean. Indicates whether this View is currently in edit mode.
[read-only]
IsInLayoutBoolean. Returns whether the view hierarchy is currently undergoing a layout pass.
[read-only]
IsInTouchModeBoolean. Returns whether the device is currently in touch mode.
[read-only]
IsLaidOutBoolean. Returns true if this view has been through at least one layout since it was last attached to or detached from a window.
[read-only]
IsLayoutDirectionResolvedBoolean.
[read-only]
IsLayoutRequestedBoolean.
[read-only]
IsOpaqueBoolean. Indicates whether this View is opaque.
[read-only]
IsPaddingRelativeBoolean. Return if the padding has been set through relative values View.SetPaddingRelative(Int32,Int32,Int32,Int32) or through
[read-only]
IsScrollContainerBoolean. Indicates whether this view is one of the set of scrollable containers in its window.
[read-only]
IsShownBoolean. Returns the visibility of this view and all of its ancestors
[read-only]
IsTextAlignmentResolvedBoolean.
[read-only]
IsTextDirectionResolvedBoolean.
KeepScreenOnBoolean. Returns whether the screen should remain on, corresponding to the current value of View.KEEP_SCREEN_ON.
[read-only]
KeyDispatcherStateKeyEvent+DispatcherState. Return the global NoType:android/view/KeyEvent$DispatcherState;Href=../../../reference/android/view/KeyEvent.DispatcherState.html for this view's window.
LabelForInt32. Gets the id of a view for which this view serves as a label for accessibility purposes.
[read-only]
LayerTypeLayerType. Indicates what type of layer is currently associated with this view.
LayoutDirectionLayoutDirection. Returns the resolved layout direction for this view.
LayoutParametersViewGroup+LayoutParams. Get the LayoutParams associated with this view.
LeftInt32. Left position of this view relative to its parent.
LongClickableBoolean. Indicates whether this view reacts to long click events or not.
[read-only]
MatrixMatrix. The transform matrix of this view, which is calculated based on the current rotation, scale, and pivot properties.
[read-only]
MeasuredHeightInt32. Like View.MeasuredHeightAndState, but only returns the raw width component (that is the result is masked by View.MeasuredSizeMask).
[read-only]
MeasuredHeightAndStateInt32. Return the full height measurement information for this view as computed by the most recent call to View.Measure(Int32,Int32).
[read-only]
MeasuredStateInt32. Return only the state bits of View.MeasuredWidthAndState and View.MeasuredHeightAndState, combined into one integer.
[read-only]
MeasuredWidthInt32. Like View.MeasuredWidthAndState, but only returns the raw width component (that is the result is masked by View.MeasuredSizeMask).
[read-only]
MeasuredWidthAndStateInt32. Return the full width measurement information for this view as computed by the most recent call to View.Measure(Int32,Int32).
[read-only]
MinimumHeightInt32. Returns the minimum height of the view.
[read-only]
MinimumWidthInt32. Returns the minimum width of the view.
NestedScrollingEnabledBoolean. Returns true if nested scrolling is enabled for this view.
NextFocusDownIdInt32. Gets the id of the view to use when the next focus is View.FOCUS_DOWN.
NextFocusForwardIdInt32. Gets the id of the view to use when the next focus is View.FOCUS_FORWARD.
NextFocusLeftIdInt32. Gets the id of the view to use when the next focus is View.FOCUS_LEFT.
NextFocusRightIdInt32. Gets the id of the view to use when the next focus is View.FOCUS_RIGHT.
NextFocusUpIdInt32. Gets the id of the view to use when the next focus is View.FOCUS_UP.
OnFocusChangeListenerView+IOnFocusChangeListener. Returns the focus-change callback registered for this view.
OutlineProviderViewOutlineProvider. Returns the current ViewOutlineProvider of the view, which generates the Outline that defines the shape of the shadow it casts, and enables outline clipping.
[read-only]
OverlayViewOverlay. Returns the overlay for this view, creating it if it does not yet exist.
OverScrollModeOverScrollMode. Returns the over-scroll mode for this view.
[read-only]
PaddingBottomInt32. Returns the bottom padding of this view.
[read-only]
PaddingEndInt32. Returns the end padding of this view depending on its resolved layout direction.
[read-only]
PaddingLeftInt32. Returns the left padding of this view.
[read-only]
PaddingRightInt32. Returns the right padding of this view.
[read-only]
PaddingStartInt32. Returns the start padding of this view depending on its resolved layout direction.
[read-only]
PaddingTopInt32. Returns the top padding of this view.
[read-only]
ParentIViewParent. Gets the parent of this view.
[read-only]
ParentForAccessibilityIViewParent. Gets the parent for accessibility purposes.
PivotXSingle. The x location of the point around which the view is View.Rotation and View.ScaleX.
PivotYSingle. The y location of the point around which the view is View.Rotation and View.ScaleY.
PressedBoolean. Indicates whether the view is currently in pressed state.
[read-only]
ResourcesResources. Returns the resources associated with this view.
RightInt32. Right position of this view relative to its parent.
[read-only]
RootViewView.
RotationSingle. The degrees that the view is rotated around the pivot point.
RotationXSingle. The degrees that the view is rotated around the horizontal axis through the pivot point.
RotationYSingle. The degrees that the view is rotated around the vertical axis through the pivot point.
SaveEnabledBoolean. Indicates whether this view will save its state (that is, whether its View.OnSaveInstanceState method will be called).
SaveFromParentEnabledBoolean. Indicates whether the entire hierarchy under this view will save its state when a state saving traversal occurs from its parent.
ScaleXSingle. The amount that the view is scaled in x around the pivot point, as a proportion of the view's unscaled width.
static
ScaleXsProperty. A Property wrapper around the scaleX functionality handled by the View.ScaleX and View.ScaleX methods.
ScaleYSingle. The amount that the view is scaled in y around the pivot point, as a proportion of the view's unscaled height.
static
ScaleYsProperty. A Property wrapper around the scaleY functionality handled by the View.ScaleY and View.ScaleY methods.
ScrollBarDefaultDelayBeforeFadeInt32. Returns the delay before scrollbars fade.
ScrollBarFadeDurationInt32. Returns the scrollbar fade duration.
ScrollbarFadingEnabledBoolean. Returns true if scrollbars will fade when this view is not scrolling
ScrollBarSizeInt32. Returns the scrollbar size.
ScrollBarStyleScrollbarStyles.
ScrollXInt32. Return the scrolled left position of this view.
ScrollYInt32. Return the scrolled top position of this view.
SelectedBoolean. Indicates the selection state of this view.
[read-only]
SolidColorColor. Override this if your view is known to always be drawn on top of a solid color background, and needs to draw fading edges.
SoundEffectsEnabledBoolean.
StateListAnimatorStateListAnimator. Returns the current StateListAnimator if exists.
SystemUiVisibilityStatusBarVisibility. Returns the last View.SystemUiVisibility that this view has requested.
TagObject. Returns this view's tag.
TextAlignmentTextAlignment. Return the resolved text alignment.
TextDirectionTextDirection. Return the resolved text direction.
TopInt32. Top position of this view relative to its parent.
[read-only]
TouchablesIList<Android.Views.View>. Find and return all touchable views that are descendants of this view, possibly including this view if it is touchable itself.
TouchDelegateTouchDelegate. Gets the TouchDelegate for this View.
TransitionNameString. Returns the name of the View to be used to identify Views in Transitions.
TranslationXSingle. The horizontal location of this view relative to its View.Left position.
TranslationYSingle. The vertical location of this view relative to its View.Top position.
TranslationZSingle. The depth location of this view relative to its View.Elevation.
VerticalFadingEdgeEnabledBoolean.
[read-only]
VerticalFadingEdgeLengthInt32. Returns the size of the vertical faded edges used to indicate that more content in this view is visible.
VerticalScrollBarEnabledBoolean.
VerticalScrollbarPositionScrollbarPosition.
[read-only]
VerticalScrollbarWidthInt32. Returns the width of the vertical scrollbar.
[read-only]
ViewTreeObserverViewTreeObserver. Returns the ViewTreeObserver for this view's hierarchy.
VisibilityViewStates. Returns the visibility status for this view.
[read-only]
WidthInt32. Return the width of the your view.
[read-only]
WindowIdWindowId. Retrieve the WindowId for the window this view is currently attached to.
[read-only]
WindowSystemUiVisibilitySystemUiFlags. Returns the current system UI visibility that is currently set for the entire window.
[read-only]
WindowTokenIBinder. Retrieve a unique token identifying the window this view is attached to.
[read-only]
WindowVisibilityViewStates. Returns the current visibility of the window this view is attached to (either ViewStates.Gone, ViewStates.Invisible, or Visible).
static
XProperty. A Property wrapper around the x functionality handled by the View.SetX(Single) and View.GetX methods.
static
YProperty. A Property wrapper around the y functionality handled by the View.SetY(Single) and View.GetY methods.
[read-only]
static
ZProperty. A Property wrapper around the z functionality handled by the View.SetZ(Single) and View.GetZ methods.

Protected Properties

[read-only]
BottomFadingEdgeStrengthSingle. Returns the strength, or intensity, of the bottom faded edge.
[read-only]
BottomPaddingOffsetInt32. Amount by which to extend the bottom fading region.
[read-only]
ContextMenuInfoIContextMenuContextMenuInfo. Views should implement this if they have extra information to associate with the context menu.
[read-only]
static
EmptyStateSetIList<int>. Indicates the view has no states set.
[read-only]
static
EnabledFocusedSelectedStateSetIList<int>. Indicates the view is enabled, focused and selected.
[read-only]
static
EnabledFocusedSelectedWindowFocusedStateSetIList<int>. Indicates the view is enabled, focused, selected and its window has the focus.
[read-only]
static
EnabledFocusedStateSetIList<int>. Indicates the view is enabled and has the focus.
[read-only]
static
EnabledFocusedWindowFocusedStateSetIList<int>. Indicates the view is enabled, focused and its window has the focus.
[read-only]
static
EnabledSelectedStateSetIList<int>. Indicates the view is enabled and selected.
[read-only]
static
EnabledSelectedWindowFocusedStateSetIList<int>. Indicates the view is enabled, selected and its window has the focus.
[read-only]
static
EnabledStateSetIList<int>. Indicates the view is enabled.
[read-only]
static
EnabledWindowFocusedStateSetIList<int>. Indicates the view is enabled and that its window has focus.
[read-only]
static
FocusedSelectedStateSetIList<int>. Indicates the view is focused and selected.
[read-only]
static
FocusedSelectedWindowFocusedStateSetIList<int>. Indicates the view is focused, selected and its window has the focus.
[read-only]
static
FocusedStateSetIList<int>. Indicates the view is focused.
[read-only]
static
FocusedWindowFocusedStateSetIList<int>. Indicates the view has the focus and that its window has the focus.
[read-only]
HorizontalScrollbarHeightInt32. Returns the height of the horizontal scrollbar.
[read-only]
IsPaddingOffsetRequiredBoolean. If the View draws content inside its padding and enables fading edges, it needs to support padding offsets.
[read-only]
LeftFadingEdgeStrengthSingle. Returns the strength, or intensity, of the left faded edge.
[read-only]
LeftPaddingOffsetInt32. Amount by which to extend the left fading region.
[read-only]
static
PressedEnabledFocusedSelectedStateSetIList<int>. Indicates the view is pressed, enabled, focused and selected.
[read-only]
static
PressedEnabledFocusedSelectedWindowFocusedStateSetIList<int>. Indicates the view is pressed, enabled, focused, selected and its window has the focus.
[read-only]
static
PressedEnabledFocusedStateSetIList<int>. Indicates the view is pressed, enabled and focused.
[read-only]
static
PressedEnabledFocusedWindowFocusedStateSetIList<int>. Indicates the view is pressed, enabled, focused and its window has the focus.
[read-only]
static
PressedEnabledSelectedStateSetIList<int>. Indicates the view is pressed, enabled and selected.
[read-only]
static
PressedEnabledSelectedWindowFocusedStateSetIList<int>. Indicates the view is pressed, enabled, selected and its window has the focus.
[read-only]
static
PressedEnabledStateSetIList<int>. Indicates the view is pressed and enabled.
[read-only]
static
PressedEnabledWindowFocusedStateSetIList<int>. Indicates the view is pressed, enabled and its window has the focus.
[read-only]
static
PressedFocusedSelectedStateSetIList<int>. Indicates the view is pressed, focused and selected.
[read-only]
static
PressedFocusedSelectedWindowFocusedStateSetIList<int>. Indicates the view is pressed, focused, selected and its window has the focus.
[read-only]
static
PressedFocusedStateSetIList<int>. Indicates the view is pressed and focused.
[read-only]
static
PressedFocusedWindowFocusedStateSetIList<int>. Indicates the view is pressed, focused and its window has the focus.
[read-only]
static
PressedSelectedStateSetIList<int>. Indicates the view is pressed and selected.
[read-only]
static
PressedSelectedWindowFocusedStateSetIList<int>. Indicates the view is pressed, selected and its window has the focus.
[read-only]
static
PressedStateSetIList<int>. Indicates the view is pressed.
[read-only]
static
PressedWindowFocusedStateSetIList<int>. Indicates the view is pressed and its window has the focus.
[read-only]
RightFadingEdgeStrengthSingle. Returns the strength, or intensity, of the right faded edge.
[read-only]
RightPaddingOffsetInt32. Amount by which to extend the right fading region.
[read-only]
static
SelectedStateSetIList<int>. Indicates the view is selected.
[read-only]
static
SelectedWindowFocusedStateSetIList<int>. Indicates the view is selected and that its window has the focus.
[read-only]
SuggestedMinimumHeightInt32. Returns the suggested minimum height that the view should use.
[read-only]
SuggestedMinimumWidthInt32. Returns the suggested minimum width that the view should use.
[read-only]
override
ThresholdClassIntPtr. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
[read-only]
override
ThresholdTypeType. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
[read-only]
TopFadingEdgeStrengthSingle. Returns the strength, or intensity, of the top faded edge.
[read-only]
TopPaddingOffsetInt32. Amount by which to extend the top fading region.
[read-only]
WindowAttachCountInt32.
[read-only]
static
WindowFocusedStateSetIList<int>. Indicates the view's window has focus.

Public Methods

AddChildrenForAccessibility(IList<Android.Views.View>)
AddFocusables(IList<Android.Views.View>, FocusSearchDirection)
AddFocusables(IList<Android.Views.View>, FocusSearchDirection, FocusablesFlags)
AddOnAttachStateChangeListener(View+IOnAttachStateChangeListener)
Add a listener for attach state changes.
AddOnLayoutChangeListener(View+IOnLayoutChangeListener)
Add a listener that will be called when the bounds of the view change due to layout processing.
AddTouchables(IList<Android.Views.View>)
Animate() : ViewPropertyAnimator
This method returns a ViewPropertyAnimator object, which can be used to animate specific properties on this View.
AnnounceForAccessibility(ICharSequence)
Convenience method for sending a AccessibilityEventCompat.TypeAnnouncementAccessibilityEvent to make an announcement which is related to some sort of a context change for which none of the events representing UI transitions is a good fit.
AnnounceForAccessibility(String)
BringToFront()
Change the view's z order in the tree, so it's on top of other sibling views.
BuildDrawingCache()
BuildDrawingCache(Boolean)
BuildLayer()
Forces this view's layer to be created and this view to be rendered into its layer.
CallOnClick() : Boolean
Directly call any attached OnClickListener.
CancelLongPress()
Cancels a pending long press.
CancelPendingInputEvents()
Cancel any deferred high-level input events that were previously posted to the event queue.
CanResolveLayoutDirection() : Boolean
Check if layout direction resolution can be done.
CanResolveTextAlignment() : Boolean
Check if text alignment resolution can be done.
CanResolveTextDirection() : Boolean
Check if text direction resolution can be done.
CanScrollHorizontally(FocusSearchDirection) : Boolean
Check if this view can be scrolled horizontally in a certain direction.
CanScrollHorizontally(Int32) : Boolean
Check if this view can be scrolled horizontally in a certain direction.
CanScrollVertically(FocusSearchDirection) : Boolean
Check if this view can be scrolled vertically in a certain direction.
CanScrollVertically(Int32) : Boolean
Check if this view can be scrolled vertically in a certain direction.
CheckInputConnectionProxy(View) : Boolean
Called by the InputMethodManager when a view who is not the current input connection target is trying to make a call on the manager.
ClearAnimation()
Cancels any animations for this view.
ClearFocus()
Called when this view wants to give up focus.
static
CombineMeasuredStates(Int32, Int32) : Int32
Merge two states as returned by View.MeasuredState.
ComputeScroll()
Called by a parent to request that a child update its values for mScrollX and mScrollY if necessary.
ComputeSystemWindowInsets(WindowInsets, Rect) : WindowInsets
Compute insets that should be consumed by this view and the ones that should propagate to those under it.
CreateAccessibilityNodeInfo() : AccessibilityNodeInfo
Returns an AccessibilityNodeInfo representing this view from the point of view of an AccessibilityService.
CreateContextMenu(IContextMenu)
Show the context menu for this view.
DestroyDrawingCache()
DispatchApplyWindowInsets(WindowInsets) : WindowInsets
Request to apply the given window insets to this view or another view in its subtree.
DispatchConfigurationChanged(Configuration)
Dispatch a notification about a resource configuration change down the view hierarchy.
DispatchDisplayHint(ViewStates)
Dispatch a hint about whether this view is displayed.
DispatchDragEvent(DragEvent) : Boolean
Detects if this View is enabled and has a drag event listener.
DispatchGenericMotionEvent(MotionEvent) : Boolean
Dispatch a generic motion event.
DispatchKeyEvent(KeyEvent) : Boolean
Dispatch a key event to the next view on the focus path.
DispatchKeyEventPreIme(KeyEvent) : Boolean
Dispatch a key event before it is processed by any input method associated with the view hierarchy.
DispatchKeyShortcutEvent(KeyEvent) : Boolean
Dispatches a key shortcut event.
DispatchNestedFling(Single, Single, Boolean) : Boolean
Dispatch a fling to a nested scrolling parent.
DispatchNestedPreFling(Single, Single) : Boolean
Dispatch a fling to a nested scrolling parent before it is processed by this view.
DispatchNestedPreScroll(Int32, Int32, Int32[], Int32[]) : Boolean
Dispatch one step of a nested scroll in progress before this view consumes any portion of it.
DispatchNestedScroll(Int32, Int32, Int32, Int32, Int32[]) : Boolean
Dispatch one step of a nested scroll in progress.
DispatchPopulateAccessibilityEvent(AccessibilityEvent) : Boolean
Dispatches an AccessibilityEvent to the View first and then to its children for adding their text content to the event.
DispatchSystemUiVisibilityChanged(SystemUiFlags)
Dispatch callbacks to View.SetOnSystemUiVisibilityChangeListener(.IOnSystemUiVisibilityChangeListener) down the view hierarchy.
DispatchSystemUiVisibilityChanged(Int32)
DispatchTouchEvent(MotionEvent) : Boolean
Pass the touch screen motion event down to the target view, or this view if it is the target.
DispatchTrackballEvent(MotionEvent) : Boolean
Pass a trackball motion event down to the focused view.
DispatchUnhandledMove(View, FocusSearchDirection) : Boolean
This method is the last chance for the focused view and its ancestors to respond to an arrow key.
DispatchWindowFocusChanged(Boolean)
Called when the window containing this view gains or loses window focus.
DispatchWindowSystemUiVisiblityChanged(SystemUiFlags)
Dispatch callbacks to View.OnWindowSystemUiVisibilityChanged(SystemUiFlags) down the view hierarchy.
DispatchWindowVisibilityChanged(ViewStates)
Dispatch a window visibility change down the view hierarchy.
Draw(Canvas)
Manually render this view (and all of its children) to the given Canvas.
DrawableHotspotChanged(Single, Single)
This function is called whenever the view hotspot changes and needs to be propagated to drawables or child views managed by the view.
FindFocus() : View
Find the view in the hierarchy rooted at this view that currently has focus.
FindViewById(Int32) : View
Look for a child view with the given id.
FindViewById<T>(Int32) : T
FindViewsWithText(IList<Android.Views.View>, ICharSequence, FindViewsWith)
FindViewsWithText(IList<Android.Views.View>, String, FindViewsWith)
FindViewWithTag(Object) : View
Look for a child view with the given tag.
FocusSearch(FocusSearchDirection) : View
Find the nearest view in the specified direction that can take focus.
ForceLayout()
Forces this view to be laid out during the next layout pass.
static
GenerateViewId() : Int32
Generate a value suitable for use in View.Id.
static
GetDefaultSize(Int32, Int32) : Int32
Utility to return a default size.
GetDrawableState() : Int32[]
Return an array of resource IDs of the drawable states representing the current state of the view.
GetDrawingCache(Boolean) : Bitmap
GetDrawingRect(Rect)
Return the visible drawing bounds of your view.
GetFocusables(FocusSearchDirection) : IList<Android.Views.View>
Find and return all focusable views that are descendants of this view, possibly including this view if it is focusable itself.
GetFocusedRect(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.
GetGlobalVisibleRect(Rect) : Boolean
GetGlobalVisibleRect(Rect, Point) : Boolean
If some part of this view is not clipped by any of its parents, then return that area in r in global (root) coordinates.
GetHitRect(Rect)
Hit rectangle in parent's coordinates
GetLocalVisibleRect(Rect) : Boolean
GetLocationInWindow(Int32[])
GetLocationOnScreen(Int32[])
GetTag(Int32) : Object
Returns the tag associated with this view and the specified key.
GetWindowVisibleDisplayFrame(Rect)
Retrieve the overall visible display size in which the window this view is attached to has been positioned in.
GetX() : Single
The visual x position of this view, in pixels.
GetY() : Single
The visual y position of this view, in pixels.
GetZ() : Single
The visual z position of this view, in pixels.
static
Inflate(Context, Int32, ViewGroup) : View
Inflate a view from an XML resource.
Invalidate()
Invalidate the whole view.
Invalidate(Rect)
Mark the area defined by dirty as needing to be drawn.
Invalidate(Int32, Int32, Int32, Int32)
Mark the area defined by the rect (l,t,r,b) as needing to be drawn.
InvalidateDrawable(Drawable)
Invalidates the specified Drawable.
InvalidateOutline()
Called to rebuild this View's Outline from its ViewOutlineProvider
InvokeFitsSystemWindows() : Boolean
JumpDrawablesToCurrentState()
Call Drawable.JumpToCurrentState on all Drawable objects associated with this view.
Layout(Int32, Int32, Int32, Int32)
Assign a size and position to a view and all of its descendants
Measure(Int32, Int32)
OffsetLeftAndRight(Int32)
Offset this view's horizontal location by the specified amount of pixels.
OffsetTopAndBottom(Int32)
Offset this view's vertical location by the specified number of pixels.
OnApplyWindowInsets(WindowInsets) : WindowInsets
Called when the view should apply WindowInsets according to its internal policy.
OnCancelPendingInputEvents()
Called as the result of a call to View.CancelPendingInputEvents on this view or a parent view.
OnCheckIsTextEditor() : 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.
OnCreateInputConnection(EditorInfo) : IInputConnection
Create a new InputConnection for an InputMethod to interact with the view.
OnDragEvent(DragEvent) : Boolean
Handles drag events sent by the system following a call to View.StartDrag(Android.Content.ClipData, .DragShadowBuilder, .DragShadowBuilder, .DragShadowBuilder).
OnFilterTouchEventForSecurity(MotionEvent) : Boolean
Filter the touch event to apply security policies.
OnFinishTemporaryDetach()
Called after View.OnStartTemporaryDetach when the container is done changing the view.
OnGenericMotionEvent(MotionEvent) : Boolean
Implement this method to handle generic motion events.
OnHoverChanged(Boolean)
Implement this method to handle hover state changes.
OnHoverEvent(MotionEvent) : Boolean
Implement this method to handle hover events.
OnInitializeAccessibilityEvent(AccessibilityEvent)
Initializes an AccessibilityEvent with information about this View which is the event source.
OnInitializeAccessibilityNodeInfo(AccessibilityNodeInfo)
Initializes an AccessibilityNodeInfo with information about this view.
OnKeyDown(Keycode, KeyEvent) : Boolean
Default implementation of NoType:android/view/KeyEvent$Callback;Href=../../../reference/android/view/KeyEvent.Callback.html#onKeyDown(int, android.view.KeyEvent): perform press of the view when KeyEvent.KEYCODE_DPAD_CENTER or KeyEvent.KEYCODE_ENTER is released, if the view is enabled and clickable.
OnKeyLongPress(Keycode, KeyEvent) : Boolean
Default implementation of NoType:android/view/KeyEvent$Callback;Href=../../../reference/android/view/KeyEvent.Callback.html#onKeyLongPress(int, android.view.KeyEvent): always returns false (doesn't handle the event).
OnKeyMultiple(Keycode, Int32, KeyEvent) : Boolean
Default implementation of NoType:android/view/KeyEvent$Callback;Href=../../../reference/android/view/KeyEvent.Callback.html#onKeyMultiple(int, int, android.view.KeyEvent): always returns false (doesn't handle the event).
OnKeyPreIme(Keycode, KeyEvent) : Boolean
Handle a key event before it is processed by any input method associated with the view hierarchy.
OnKeyShortcut(Keycode, KeyEvent) : Boolean
Called on the focused view when a key shortcut event is not handled.
OnKeyUp(Keycode, KeyEvent) : Boolean
Default implementation of NoType:android/view/KeyEvent$Callback;Href=../../../reference/android/view/KeyEvent.Callback.html#onKeyUp(int, android.view.KeyEvent): perform clicking of the view when KeyEvent.KEYCODE_DPAD_CENTER or KeyEvent.KEYCODE_ENTER is released.
OnPopulateAccessibilityEvent(AccessibilityEvent)
Called from View.DispatchPopulateAccessibilityEvent(AccessibilityEvent) giving a chance to this View to populate the accessibility event with its text content.
OnRtlPropertiesChanged(LayoutDirection)
Called when any RTL property (layout direction or text direction or text alignment) has been changed.
OnScreenStateChanged(ScreenState)
This method is called whenever the state of the screen this view is attached to changes.
OnStartTemporaryDetach()
This is called when a container is going to temporarily detach a child, with ViewGroup.DetachViewFromParent(View).
OnTouchEvent(MotionEvent) : Boolean
Implement this method to handle touch screen motion events.
OnTrackballEvent(MotionEvent) : Boolean
Implement this method to handle trackball motion events.
OnWindowFocusChanged(Boolean)
Called when the window containing this view gains or loses focus.
OnWindowSystemUiVisibilityChanged(SystemUiFlags)
Override to find out when the window's requested system UI visibility has changed, that is the value returned by View.WindowSystemUiVisibility.
PerformAccessibilityAction(GlobalAction, Bundle) : Boolean
Performs the specified accessibility action on the view.
PerformClick() : Boolean
Call this view's OnClickListener, if it is defined.
PerformHapticFeedback(FeedbackConstants) : Boolean
BZZZTT!!1!
PerformHapticFeedback(FeedbackConstants, FeedbackFlags) : Boolean
BZZZTT!!1!
PerformLongClick() : Boolean
Call this view's OnLongClickListener, if it is defined.
PlaySoundEffect(SoundEffects)
Play a sound effect for this view.
Post(IRunnable) : Boolean
Post(Action) : Boolean
PostDelayed(IRunnable, Int64) : Boolean
PostDelayed(Action, Int64) : Boolean
PostInvalidate()
PostInvalidate(Int32, Int32, Int32, Int32)
PostInvalidateDelayed(Int64)
PostInvalidateDelayed(Int64, Int32, Int32, Int32, Int32)
PostInvalidateOnAnimation()
PostInvalidateOnAnimation(Int32, Int32, Int32, Int32)
PostOnAnimation(IRunnable)
PostOnAnimationDelayed(IRunnable, Int64)
RefreshDrawableState()
Call this to force a view to update its drawable state.
RemoveCallbacks(IRunnable) : Boolean
RemoveCallbacks(Action) : Boolean
RemoveOnAttachStateChangeListener(View+IOnAttachStateChangeListener)
Remove a listener for attach state changes.
RemoveOnLayoutChangeListener(View+IOnLayoutChangeListener)
Remove a listener for layout changes.
RequestApplyInsets()
Ask that a new dispatch of View.OnApplyWindowInsets(WindowInsets) be performed.
RequestFitSystemWindows()
Ask that a new dispatch of View.FitSystemWindows(Rect) be performed.
RequestFocus() : Boolean
Call this to try to give focus to a specific view or to one of its descendants.
RequestFocus(FocusSearchDirection) : Boolean
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.
RequestFocus(FocusSearchDirection, Rect) : Boolean
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.
RequestFocusFromTouch() : Boolean
Call this to try to give focus to a specific view or to one of its descendants.
RequestLayout()
Call this when something has changed which has invalidated the layout of this view.
RequestRectangleOnScreen(Rect) : Boolean
Request that a rectangle of this view be visible on the screen, scrolling if necessary just enough.
RequestRectangleOnScreen(Rect, Boolean) : Boolean
Request that a rectangle of this view be visible on the screen, scrolling if necessary just enough.
RequestUnbufferedDispatch(MotionEvent)
Request unbuffered dispatch of the given stream of MotionEvents to this View.
static
ResolveSize(Int32, Int32) : Int32
Version of View.ResolveSizeAndState(Int32,Int32,Int32) returning only the View.MeasuredSizeMask bits of the result.
static
ResolveSizeAndState(Int32, Int32, Int32) : Int32
Utility to reconcile a desired size and state, with constraints imposed by a MeasureSpec.
RestoreHierarchyState(SparseArray)
SaveHierarchyState(SparseArray)
ScheduleDrawable(Drawable, IRunnable, Int64)
Schedules an action on a drawable to occur at a specified time.
ScheduleDrawable(Drawable, Action, Int64)
ScrollBy(Int32, Int32)
Move the scrolled position of your view.
ScrollTo(Int32, Int32)
Set the scrolled position of your view.
SendAccessibilityEvent(EventTypes)
Sends an accessibility event of the given type.
SendAccessibilityEventUnchecked(AccessibilityEvent)
This method behaves exactly as View.SendAccessibilityEvent(EventTypes) but takes as an argument an empty AccessibilityEvent and does not perform a check whether accessibility is enabled.
SetAccessibilityDelegate(View+AccessibilityDelegate)
Sets a delegate for implementing accessibility support via composition as opposed to inheritance.
SetBackgroundColor(Color)
Sets the background color for this view.
SetBackgroundDrawable(Drawable)
SetBackgroundResource(Int32)
Set the background to a given resource.
SetCameraDistance(Single)

java Example

 float scale = context.getResources().getDisplayMetrics().density;
 view.setCameraDistance(distance * scale);
SetFadingEdgeLength(Int32)
Set the size of the faded edge used to indicate that more content in this view is available.
SetFitsSystemWindows(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 View.FitSystemWindows(Rect) will be executed.
SetLayerPaint(Paint)
Updates the Paint object used with the current layer (used only if the current layer type is not set to View.LAYER_TYPE_NONE).
SetLayerType(LayerType, Paint)
SetMinimumHeight(Int32)
Sets the minimum height of the view.
SetMinimumWidth(Int32)
Sets the minimum width of the view.
SetOnApplyWindowInsetsListener(View+IOnApplyWindowInsetsListener)
Set an NoType:android/view/View$OnApplyWindowInsetsListener;Href=../../../reference/android/view/View.OnApplyWindowInsetsListener.html to take over the policy for applying window insets to this view.
SetOnClickListener(View+IOnClickListener)
Register a callback to be invoked when this view is clicked.
SetOnCreateContextMenuListener(View+IOnCreateContextMenuListener)
Register a callback to be invoked when the context menu for this view is being built.
SetOnDragListener(View+IOnDragListener)
Register a drag event listener callback object for this View.
SetOnGenericMotionListener(View+IOnGenericMotionListener)
Register a callback to be invoked when a generic motion event is sent to this view.
SetOnHoverListener(View+IOnHoverListener)
Register a callback to be invoked when a hover event is sent to this view.
SetOnKeyListener(View+IOnKeyListener)
Register a callback to be invoked when a hardware key is pressed in this view.
SetOnLongClickListener(View+IOnLongClickListener)
Register a callback to be invoked when this view is clicked and held.
SetOnSystemUiVisibilityChangeListener(View+IOnSystemUiVisibilityChangeListener)
Set a listener to receive callbacks when the visibility of the system bar changes.
SetOnTouchListener(View+IOnTouchListener)
Register a callback to be invoked when a touch event is sent to this view.
SetPadding(Int32, Int32, Int32, Int32)
Sets the padding.
SetPaddingRelative(Int32, Int32, Int32, Int32)
Sets the relative padding.
SetScrollContainer(Boolean)
Change whether this view is one of the set of scrollable containers in its window.
SetTag(Int32, Object)
Sets a tag associated with this view and a key.
SetWillNotCacheDrawing(Boolean)
When a View's drawing cache is enabled, drawing is redirected to an offscreen bitmap.
SetWillNotDraw(Boolean)
If this view doesn't do any drawing on its own, set this flag to allow further optimizations.
SetX(Single)
Sets the visual x position of this view, in pixels.
SetY(Single)
Sets the visual y position of this view, in pixels.
SetZ(Single)
Sets the visual z position of this view, in pixels.
ShowContextMenu() : Boolean
Bring up the context menu for this view.
StartActionMode(ActionMode+ICallback) : ActionMode
Start an action mode with the default type ActionMode.TYPE_PRIMARY.
StartAnimation(Animation)
Start the specified animation now.
StartDrag(ClipData, View+DragShadowBuilder, Object, Int32) : Boolean
Starts a drag and drop operation.
StartNestedScroll(ScrollAxis) : Boolean
Begin a nestable scroll operation along the given axes.
StopNestedScroll()
Stop a nested scroll in progress.
UnscheduleDrawable(Drawable)
Unschedule any events associated with the given Drawable.
UnscheduleDrawable(Drawable, IRunnable)
Cancels a scheduled action on a drawable.
UnscheduleDrawable(Drawable, Action)
WillNotCacheDrawing() : Boolean
Returns whether or not this View can cache its drawing or not.
WillNotDraw() : Boolean
Returns whether or not this View draws on its own.

Protected Methods

AwakenScrollBars() : Boolean
AwakenScrollBars(Int32) : Boolean
AwakenScrollBars(Int32, Boolean) : Boolean
ComputeHorizontalScrollExtent() : Int32
ComputeHorizontalScrollOffset() : Int32
ComputeHorizontalScrollRange() : Int32
ComputeVerticalScrollExtent() : Int32
ComputeVerticalScrollOffset() : Int32
ComputeVerticalScrollRange() : Int32
DispatchDraw(Canvas)
Called by draw to draw the child views.
DispatchGenericFocusedEvent(MotionEvent) : Boolean
Dispatch a generic motion event to the currently focused view.
DispatchGenericPointerEvent(MotionEvent) : Boolean
Dispatch a generic motion event to the view under the first pointer.
DispatchHoverEvent(MotionEvent) : Boolean
Dispatch a hover event.
DispatchRestoreInstanceState(SparseArray)
DispatchSaveInstanceState(SparseArray)
DispatchSetActivated(Boolean)
Dispatch setActivated to all of this View's children.
DispatchSetPressed(Boolean)
Dispatch setPressed to all of this View's children.
DispatchSetSelected(Boolean)
Dispatch setSelected to all of this View's children.
DispatchVisibilityChanged(View, ViewStates)
Dispatch a view visibility change down the view hierarchy.
DrawableStateChanged()
This function is called whenever the state of the view changes in such a way that it impacts the state of drawables being shown.
FitSystemWindows(Rect) : Boolean
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.
InitializeFadingEdge(TypedArray)
InitializeScrollbars(TypedArray)
static
MergeDrawableStates(Int32[], Int32[]) : Int32[]
Merge your own state values in additionalState into the base state values baseState that were returned by View.OnCreateDrawableState(Int32).
OnAnimationEnd()
Invoked by a parent ViewGroup to notify the end of the animation currently associated with this view.
OnAnimationStart()
Invoked by a parent ViewGroup to notify the start of the animation currently associated with this view.
OnAttachedToWindow()
This is called when the view is attached to a window.
OnConfigurationChanged(Configuration)
Called when the current configuration of the resources being used by the application have changed.
OnCreateContextMenu(IContextMenu)
Views should implement this if the view itself is going to add items to the context menu.
OnCreateDrawableState(Int32) : Int32[]
Generate the new Drawable state for this view.
OnDetachedFromWindow()
This is called when the view is detached from a window.
OnDisplayHint(Int32)
Gives this view a hint about whether is displayed or not.
OnDraw(Canvas)
Implement this to do your drawing.
OnDrawScrollBars(Canvas)
OnFinishInflate()
Finalize inflating a view from XML.
OnFocusChanged(Boolean, FocusSearchDirection, Rect)
Called by the view system when the focus state of this view changes.
OnLayout(Boolean, Int32, Int32, Int32, Int32)
Called from layout when this view should assign a size and position to each of its children.
OnMeasure(Int32, Int32)
OnOverScrolled(Int32, Int32, Boolean, Boolean)
Called by View.OverScrollBy(Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32) to respond to the results of an over-scroll operation.
OnRestoreInstanceState(IParcelable)
Hook allowing a view to re-apply a representation of its internal state that had previously been generated by View.OnSaveInstanceState.
OnSaveInstanceState() : IParcelable
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.
OnScrollChanged(Int32, Int32, Int32, Int32)
This is called in response to an internal scroll in this view (i.e., the view scrolled its own contents).
OnSetAlpha(Int32) : Boolean
Invoked if there is a Transform that involves alpha.
OnSizeChanged(Int32, Int32, Int32, Int32)
This is called during layout when the size of this view has changed.
OnVisibilityChanged(View, ViewStates)
Called when the visibility of the view or an ancestor of the view has changed.
OnWindowVisibilityChanged(ViewStates)
Called when the window containing has change its visibility (between ViewStates.Gone, ViewStates.Invisible, and Visible).
OverScrollBy(Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Boolean) : Boolean
Scroll the view with standard behavior for scrolling beyond the normal content boundaries.
SetMeasuredDimension(Int32, Int32)
VerifyDrawable(Drawable) : Boolean
If your view subclass is displaying its own Drawable objects, it should override this function and return true for any Drawable it is displaying.

Public Events