Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
    /*
     * Copyright (C) 2006 The Android Open Source Project
     *
     * Licensed under the Apache License, Version 2.0 (the "License");
     * you may not use this file except in compliance with the License.
     * You may obtain a copy of the License at
     *
     *      http://www.apache.org/licenses/LICENSE-2.0
     *
    * Unless required by applicable law or agreed to in writing, software
    * distributed under the License is distributed on an "AS IS" BASIS,
    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    * See the License for the specific language governing permissions and
    * limitations under the License.
    */
   
   package android.view;
   
   import android.os.Handler;
   import android.os.IBinder;
   import android.os.Message;
   import android.os.Parcel;
   import android.util.Log;
   import android.util.Pool;
   import android.util.Pools;
   
   import static android.os.Build.VERSION_CODES.*;
   
   
   import java.util.ArrayList;
   import java.util.Arrays;
   import java.util.Locale;

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.

Developer Guides

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

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 handled 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 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).

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.
onFinishInflate()Called after a view and all of its children has been inflated from XML.
LayoutonMeasure(int,int)Called to determine the size requirements for this view and all of its children.
onLayout(boolean,int,int,int,int)Called when this view should assign a size and position to all of its children.
onSizeChanged(int,int,int,int)Called when the size of this view has changed.
DrawingonDraw(android.graphics.Canvas)Called when the view should render its content.
Event processingonKeyDown(int,android.view.KeyEvent)Called when a new key event occurs.
onKeyUp(int,android.view.KeyEvent)Called when a key up event occurs.
onTrackballEvent(android.view.MotionEvent)Called when a trackball motion event occurs.
onTouchEvent(android.view.MotionEvent)Called when a touch screen motion event occurs.
FocusonFocusChanged(boolean,int,android.graphics.Rect)Called when the view gains or loses focus.
onWindowFocusChanged(boolean)Called when the window containing the view gains or loses focus.
AttachingonAttachedToWindow()Called when the view is attached to a window.
onDetachedFromWindow()Called when the view is detached from its window.
onWindowVisibilityChanged(int)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 = (Button) findViewById(R.id.my_button);
     

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

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) method and queried by calling getPaddingLeft(), getPaddingTop(), getPaddingRight(), getPaddingBottom().

Even though a view can define a padding, it does not provide any support for margins. However, view groups provide such a support. Refer to ViewGroup and ViewGroup.MarginLayoutParams for further information.

Layout

Layout is a two pass process: a measure pass and a layout pass. The measuring pass is implemented in measure(int,int) and is a top-down traversal of the view tree. Each view pushes dimension specifications down the tree during the recursion. At the end of the measure pass, every view has stored its measurements. The second pass happens in layout(int,int,int,int) and is also top-down. During this pass each parent is responsible for positioning all of its children using the sizes computed in the measure pass.

When a view's measure() method returns, its getMeasuredWidth() and getMeasuredHeight() values must be set, along with those for all of that view's descendants. A view's measured width and measured height values must respect the constraints imposed by the view's parents. This guarantees that at the end of the measure pass, all parents accept all of their children's measurements. A parent view may call measure() more than once on its children. For example, the parent may measure each child once with unspecified dimensions to find out how big they want to be, then call measure() on them again with actual numbers if the sum of all the children's unconstrained sizes is too big or too small.

The measure pass uses two classes to communicate dimensions. The View.MeasureSpec class is used by views to tell their parents how they want to be measured and positioned. The base LayoutParams class just describes how big the view wants to be for both width and height. For each dimension, it can specify one of:

  • 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 gurantee that it and all of its descendants will fit within this size.

To intiate a layout, call requestLayout(). This method is typically called by a view on itself when it believes that is can no longer fit within its current bounds.

Drawing

Drawing is handled by walking the tree and rendering each view that intersects the invalid region. Because the tree is traversed in-order, this means that parents will draw 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 for you before calling back to its onDraw() method.

Note that the framework will not draw views that are not in the invalid region.

To force a view to draw, call invalidate().

Event Handling and Threading

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 requestLayout().
  3. Similarly, if in the course of processing the event the view's appearance may need to be changed, the view will call invalidate().
  4. If either requestLayout() or invalidate() were called, the framework will take care of measuring, laying out, and drawing the tree as appropriate.

Note: The entire view tree is single threaded. You must always be on the UI thread when calling any method on any view. If you are doing work on other threads and want to update the state of a view from that thread, you should use a android.os.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.Activitys. 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.

Animation

You can attach an android.view.animation.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.

Starting with Android 3.0, the preferred way of animating views is to use the android.animation package APIs.

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. As a result, the view will not receive touches whenever a toast, dialog or other window appears above the view's window.

For more fine-grained control over security, consider overriding the onFilterTouchEventForSecurity(android.view.MotionEvent) method to implement your own security policy. See also MotionEvent.FLAG_WINDOW_IS_OBSCURED.

See also:
ViewGroup
Attr:
ref android.R.styleable#View_alpha
Attr:
ref android.R.styleable#View_background
Attr:
ref android.R.styleable#View_clickable
Attr:
ref android.R.styleable#View_contentDescription
Attr:
ref android.R.styleable#View_drawingCacheQuality
Attr:
ref android.R.styleable#View_duplicateParentState
Attr:
ref android.R.styleable#View_id
Attr:
ref android.R.styleable#View_requiresFadingEdge
Attr:
ref android.R.styleable#View_fadingEdgeLength
Attr:
ref android.R.styleable#View_filterTouchesWhenObscured
Attr:
ref android.R.styleable#View_fitsSystemWindows
Attr:
ref android.R.styleable#View_isScrollContainer
Attr:
ref android.R.styleable#View_focusable
Attr:
ref android.R.styleable#View_focusableInTouchMode
Attr:
ref android.R.styleable#View_hapticFeedbackEnabled
Attr:
ref android.R.styleable#View_keepScreenOn
Attr:
ref android.R.styleable#View_layerType
Attr:
ref android.R.styleable#View_longClickable
Attr:
ref android.R.styleable#View_minHeight
Attr:
ref android.R.styleable#View_minWidth
Attr:
ref android.R.styleable#View_nextFocusDown
Attr:
ref android.R.styleable#View_nextFocusLeft
Attr:
ref android.R.styleable#View_nextFocusRight
Attr:
ref android.R.styleable#View_nextFocusUp
Attr:
ref android.R.styleable#View_onClick
Attr:
ref android.R.styleable#View_padding
Attr:
ref android.R.styleable#View_paddingBottom
Attr:
ref android.R.styleable#View_paddingLeft
Attr:
ref android.R.styleable#View_paddingRight
Attr:
ref android.R.styleable#View_paddingTop
Attr:
ref android.R.styleable#View_saveEnabled
Attr:
ref android.R.styleable#View_rotation
Attr:
ref android.R.styleable#View_rotationX
Attr:
ref android.R.styleable#View_rotationY
Attr:
ref android.R.styleable#View_scaleX
Attr:
ref android.R.styleable#View_scaleY
Attr:
ref android.R.styleable#View_scrollX
Attr:
ref android.R.styleable#View_scrollY
Attr:
ref android.R.styleable#View_scrollbarSize
Attr:
ref android.R.styleable#View_scrollbarStyle
Attr:
ref android.R.styleable#View_scrollbars
Attr:
ref android.R.styleable#View_scrollbarDefaultDelayBeforeFade
Attr:
ref android.R.styleable#View_scrollbarFadeDuration
Attr:
ref android.R.styleable#View_scrollbarTrackHorizontal
Attr:
ref android.R.styleable#View_scrollbarThumbHorizontal
Attr:
ref android.R.styleable#View_scrollbarThumbVertical
Attr:
ref android.R.styleable#View_scrollbarTrackVertical
Attr:
ref android.R.styleable#View_scrollbarAlwaysDrawHorizontalTrack
Attr:
ref android.R.styleable#View_scrollbarAlwaysDrawVerticalTrack
Attr:
ref android.R.styleable#View_soundEffectsEnabled
Attr:
ref android.R.styleable#View_tag
Attr:
ref android.R.styleable#View_transformPivotX
Attr:
ref android.R.styleable#View_transformPivotY
Attr:
ref android.R.styleable#View_translationX
Attr:
ref android.R.styleable#View_translationY
Attr:
ref android.R.styleable#View_visibility
  
  public class View implements Drawable.CallbackDrawable.Callback2KeyEvent.Callback,
          AccessibilityEventSource {
      private static final boolean DBG = false;

    
The logging tag used by this class with android.util.Log.
  
      protected static final String VIEW_LOG_TAG = "View";

    
Used to mark a View that has no ID.
  
      public static final int NO_ID = -1;

    
This view does not want keystrokes. Use with TAKES_FOCUS_MASK when calling setFlags.
  
      private static final int NOT_FOCUSABLE = 0x00000000;

    
This view wants keystrokes. Use with TAKES_FOCUS_MASK when calling setFlags.
  
      private static final int FOCUSABLE = 0x00000001;

    
Mask for use with setFlags indicating bits used for focus.
  
      private static final int FOCUSABLE_MASK = 0x00000001;

    
This view will adjust its padding to fit sytem windows (e.g. status bar)
  
      private static final int FITS_SYSTEM_WINDOWS = 0x00000002;

    
This view is visible. Use with setVisibility(int) and android:visibility.
  
      public static final int VISIBLE = 0x00000000;

    
This view is invisible, but it still takes up space for layout purposes. Use with setVisibility(int) and android:visibility.
  
      public static final int INVISIBLE = 0x00000004;

    
This view is invisible, and it doesn't take any space for layout purposes. Use with setVisibility(int) and android:visibility.
  
      public static final int GONE = 0x00000008;

    
Mask for use with setFlags indicating bits used for visibility.
  
      static final int VISIBILITY_MASK = 0x0000000C;
  
      private static final int[] VISIBILITY_FLAGS = {};

    
This view is enabled. Intrepretation varies by subclass. Use with ENABLED_MASK when calling setFlags.
  
      static final int ENABLED = 0x00000000;

    
This view is disabled. Intrepretation varies by subclass. Use with ENABLED_MASK when calling setFlags.
  
      static final int DISABLED = 0x00000020;

   
Mask for use with setFlags indicating bits used for indicating whether this view is enabled
  
      static final int ENABLED_MASK = 0x00000020;

    
This view won't draw. onDraw(android.graphics.Canvas) won't be called and further optimizations will be performed. It is okay to have this flag set and a background. Use with DRAW_MASK when calling setFlags.
  
      static final int WILL_NOT_DRAW = 0x00000080;

    
Mask for use with setFlags indicating bits used for indicating whether this view is will draw
  
      static final int DRAW_MASK = 0x00000080;

    

This view doesn't show scrollbars.

  
      static final int SCROLLBARS_NONE = 0x00000000;

    

This view shows horizontal scrollbars.

  
      static final int SCROLLBARS_HORIZONTAL = 0x00000100;

    

This view shows vertical scrollbars.

  
      static final int SCROLLBARS_VERTICAL = 0x00000200;

    

Mask for use with setFlags indicating bits used for indicating which scrollbars are enabled.

  
      static final int SCROLLBARS_MASK = 0x00000300;

    
Indicates that the view should filter touches when its window is obscured. Refer to the class comments for more information about this security feature.
  
      static final int FILTER_TOUCHES_WHEN_OBSCURED = 0x00000400;
  
      // note flag value 0x00000800 is now available for next flags...
  
    

This view doesn't show fading edges.

  
      static final int FADING_EDGE_NONE = 0x00000000;

    

This view shows horizontal fading edges.

  
      static final int FADING_EDGE_HORIZONTAL = 0x00001000;

    

This view shows vertical fading edges.

  
      static final int FADING_EDGE_VERTICAL = 0x00002000;

    

Mask for use with setFlags indicating bits used for indicating which fading edges are enabled.

  
      static final int FADING_EDGE_MASK = 0x00003000;

    

Indicates this view can be clicked. When clickable, a View reacts to clicks by notifying the OnClickListener.

  
      static final int CLICKABLE = 0x00004000;

    

Indicates this view is caching its drawing into a bitmap.

  
      static final int DRAWING_CACHE_ENABLED = 0x00008000;

    

Indicates that no icicle should be saved for this view.

  
      static final int SAVE_DISABLED = 0x000010000;

    

Mask for use with setFlags indicating bits used for the saveEnabled property.

  
      static final int SAVE_DISABLED_MASK = 0x000010000;

    

Indicates that no drawing cache should ever be created for this view.

  
      static final int WILL_NOT_CACHE_DRAWING = 0x000020000;

    

Indicates this view can take / keep focus when int touch mode.

  
      static final int FOCUSABLE_IN_TOUCH_MODE = 0x00040000;

    

Enables low quality mode for the drawing cache.

  
      public static final int DRAWING_CACHE_QUALITY_LOW = 0x00080000;

    

Enables high quality mode for the drawing cache.

  
      public static final int DRAWING_CACHE_QUALITY_HIGH = 0x00100000;

    

Enables automatic quality mode for the drawing cache.

  
      public static final int DRAWING_CACHE_QUALITY_AUTO = 0x00000000;
  
      private static final int[] DRAWING_CACHE_QUALITY_FLAGS = {
      };

    

Mask for use with setFlags indicating bits used for the cache quality property.

  
      static final int DRAWING_CACHE_QUALITY_MASK = 0x00180000;

    

Indicates this view can be long clicked. When long clickable, a View reacts to long clicks by notifying the OnLongClickListener or showing a context menu.

  
      static final int LONG_CLICKABLE = 0x00200000;

    

Indicates that this view gets its drawable states from its direct parent and ignores its original internal states.

Hide:
  
      static final int DUPLICATE_PARENT_STATE = 0x00400000;

    
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.
  
      public static final int SCROLLBARS_INSIDE_OVERLAY = 0;

    
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.
  
      public static final int SCROLLBARS_INSIDE_INSET = 0x01000000;

    
The scrollbar style to display the scrollbars at the edge of the view, without increasing the padding. The scrollbars will be overlaid with translucency.
  
      public static final int SCROLLBARS_OUTSIDE_OVERLAY = 0x02000000;

    
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.
  
      public static final int SCROLLBARS_OUTSIDE_INSET = 0x03000000;

    
Mask to check if the scrollbar style is overlay or inset.
  
      static final int SCROLLBARS_INSET_MASK = 0x01000000;

    
Mask to check if the scrollbar style is inside or outside.
  
      static final int SCROLLBARS_OUTSIDE_MASK = 0x02000000;

    
Mask for scrollbar style.
  
      static final int SCROLLBARS_STYLE_MASK = 0x03000000;

    
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.
  
      public static final int KEEP_SCREEN_ON = 0x04000000;

    
View flag indicating whether this view should have sound effects enabled for events such as clicking and touching.
  
      public static final int SOUND_EFFECTS_ENABLED = 0x08000000;

    
View flag indicating whether this view should have haptic feedback enabled for events such as long presses.
  
      public static final int HAPTIC_FEEDBACK_ENABLED = 0x10000000;

    

Indicates that the view hierarchy should stop saving state when it reaches this view. If state saving is initiated immediately at the view, it will be allowed.

  
      static final int PARENT_SAVE_DISABLED = 0x20000000;

    

Mask for use with setFlags indicating bits used for PARENT_SAVE_DISABLED.

  
      static final int PARENT_SAVE_DISABLED_MASK = 0x20000000;

    
Horizontal direction of this view is from Left to Right. Use with setLayoutDirection(int).
  
      public static final int LAYOUT_DIRECTION_LTR = 0x00000000;

    
Horizontal direction of this view is from Right to Left. Use with setLayoutDirection(int).
  
      public static final int LAYOUT_DIRECTION_RTL = 0x40000000;

    
Horizontal direction of this view is inherited from its parent. Use with setLayoutDirection(int).
  
      public static final int LAYOUT_DIRECTION_INHERIT = 0x80000000;

    
Horizontal direction of this view is from deduced from the default language script for the locale. Use with setLayoutDirection(int).
  
      public static final int LAYOUT_DIRECTION_LOCALE = 0xC0000000;

    
Mask for use with setFlags indicating bits used for horizontalDirection.
  
      static final int LAYOUT_DIRECTION_MASK = 0xC0000000;
  
      /*
       * Array of horizontal direction flags for mapping attribute "horizontalDirection" to correct
       * flag value.
       * {@hide}
       */
      private static final int[] LAYOUT_DIRECTION_FLAGS = {,
Default horizontalDirection.
  
      private static final int LAYOUT_DIRECTION_DEFAULT = ;

    
View flag indicating whether addFocusables(java.util.ArrayList,int,int) should add all focusable Views regardless if they are focusable in touch mode.
     public static final int FOCUSABLES_ALL = 0x00000000;

    
View flag indicating whether addFocusables(java.util.ArrayList,int,int) should add only Views focusable in touch mode.
     public static final int FOCUSABLES_TOUCH_MODE = 0x00000001;

    
Use with focusSearch(int). Move focus to the previous selectable item.
     public static final int FOCUS_BACKWARD = 0x00000001;

    
Use with focusSearch(int). Move focus to the next selectable item.
     public static final int FOCUS_FORWARD = 0x00000002;

    
Use with focusSearch(int). Move focus to the left.
     public static final int FOCUS_LEFT = 0x00000011;

    
Use with focusSearch(int). Move focus up.
     public static final int FOCUS_UP = 0x00000021;

    
Use with focusSearch(int). Move focus to the right.
     public static final int FOCUS_RIGHT = 0x00000042;

    
Use with focusSearch(int). Move focus down.
     public static final int FOCUS_DOWN = 0x00000082;

    
Bits of getMeasuredWidthAndState() and getMeasuredWidthAndState() that provide the actual measured size.
     public static final int MEASURED_SIZE_MASK = 0x00ffffff;

    
Bits of getMeasuredWidthAndState() and getMeasuredWidthAndState() that provide the additional state bits.
     public static final int MEASURED_STATE_MASK = 0xff000000;

    
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).
     public static final int MEASURED_HEIGHT_STATE_SHIFT = 16;

    
Bit of getMeasuredWidthAndState() and getMeasuredWidthAndState() that indicates the measured size is smaller that the space the view would like to have.
     public static final int MEASURED_STATE_TOO_SMALL = 0x01000000;

    
Base View state sets
     // Singles
     
Indicates the view has no states set. States are used with android.graphics.drawable.Drawable to change the drawing of the view depending on its state.

     protected static final int[] EMPTY_STATE_SET;
    
Indicates the view is enabled. States are used with android.graphics.drawable.Drawable to change the drawing of the view depending on its state.

     protected static final int[] ENABLED_STATE_SET;
    
Indicates the view is focused. States are used with android.graphics.drawable.Drawable to change the drawing of the view depending on its state.

     protected static final int[] FOCUSED_STATE_SET;
    
Indicates the view is selected. States are used with android.graphics.drawable.Drawable to change the drawing of the view depending on its state.

     protected static final int[] SELECTED_STATE_SET;
    
Indicates the view is pressed. States are used with android.graphics.drawable.Drawable to change the drawing of the view depending on its state.

     protected static final int[] PRESSED_STATE_SET;
    
Indicates the view's window has focus. States are used with android.graphics.drawable.Drawable to change the drawing of the view depending on its state.

     protected static final int[] WINDOW_FOCUSED_STATE_SET;
     // Doubles
     
Indicates the view is enabled and has the focus.

     protected static final int[] ENABLED_FOCUSED_STATE_SET;
    
Indicates the view is enabled and selected.

     protected static final int[] ENABLED_SELECTED_STATE_SET;
    
Indicates the view is enabled and that its window has focus.

     protected static final int[] ENABLED_WINDOW_FOCUSED_STATE_SET;
    
Indicates the view is focused and selected.

     protected static final int[] FOCUSED_SELECTED_STATE_SET;
    
Indicates the view has the focus and that its window has the focus.

     protected static final int[] FOCUSED_WINDOW_FOCUSED_STATE_SET;
    
Indicates the view is selected and that its window has the focus.

     protected static final int[] SELECTED_WINDOW_FOCUSED_STATE_SET;
     // Triples
     
Indicates the view is enabled, focused and selected.

     protected static final int[] ENABLED_FOCUSED_SELECTED_STATE_SET;
    
Indicates the view is enabled, focused and its window has the focus.

     protected static final int[] ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET;
    
Indicates the view is enabled, selected and its window has the focus.

     protected static final int[] ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET;
    
Indicates the view is focused, selected and its window has the focus.

     protected static final int[] FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET;
    
Indicates the view is enabled, focused, selected and its window has the focus.

     protected static final int[] ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET;
    
Indicates the view is pressed and its window has the focus.

     protected static final int[] PRESSED_WINDOW_FOCUSED_STATE_SET;
    
Indicates the view is pressed and selected.

     protected static final int[] PRESSED_SELECTED_STATE_SET;
    
Indicates the view is pressed, selected and its window has the focus.

     protected static final int[] PRESSED_SELECTED_WINDOW_FOCUSED_STATE_SET;
    
Indicates the view is pressed and focused.

     protected static final int[] PRESSED_FOCUSED_STATE_SET;
    
Indicates the view is pressed, focused and its window has the focus.

     protected static final int[] PRESSED_FOCUSED_WINDOW_FOCUSED_STATE_SET;
    
Indicates the view is pressed, focused and selected.

     protected static final int[] PRESSED_FOCUSED_SELECTED_STATE_SET;
    
Indicates the view is pressed, focused, selected and its window has the focus.

     protected static final int[] PRESSED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET;
    
Indicates the view is pressed and enabled.

     protected static final int[] PRESSED_ENABLED_STATE_SET;
    
Indicates the view is pressed, enabled and its window has the focus.

     protected static final int[] PRESSED_ENABLED_WINDOW_FOCUSED_STATE_SET;
    
Indicates the view is pressed, enabled and selected.

     protected static final int[] PRESSED_ENABLED_SELECTED_STATE_SET;
    
Indicates the view is pressed, enabled, selected and its window has the focus.

     protected static final int[] PRESSED_ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET;
    
Indicates the view is pressed, enabled and focused.

     protected static final int[] PRESSED_ENABLED_FOCUSED_STATE_SET;
    
Indicates the view is pressed, enabled, focused and its window has the focus.

     protected static final int[] PRESSED_ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET;
    
Indicates the view is pressed, enabled, focused and selected.

     protected static final int[] PRESSED_ENABLED_FOCUSED_SELECTED_STATE_SET;
    
Indicates the view is pressed, enabled, focused, selected and its window has the focus.

     protected static final int[] PRESSED_ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET;

    
The order here is very important to getDrawableState()
     private static final int[][] VIEW_STATE_SETS;
     static final int VIEW_STATE_WINDOW_FOCUSED = 1;
     static final int VIEW_STATE_SELECTED = 1 << 1;
     static final int VIEW_STATE_FOCUSED = 1 << 2;
     static final int VIEW_STATE_ENABLED = 1 << 3;
     static final int VIEW_STATE_PRESSED = 1 << 4;
     static final int VIEW_STATE_ACTIVATED = 1 << 5;
     static final int VIEW_STATE_ACCELERATED = 1 << 6;
     static final int VIEW_STATE_HOVERED = 1 << 7;
     static final int VIEW_STATE_DRAG_CAN_ACCEPT = 1 << 8;
     static final int VIEW_STATE_DRAG_HOVERED = 1 << 9;
     static final int[] VIEW_STATE_IDS = new int[] {
         ..,          ,
         ..,           ,
         ..,           ,
         ..,           ,
         ..,         ,
         ..,       ,
         ..,           ,
         ..,      ,
     };
     static {
         if ((./2) != ...) {
             throw new IllegalStateException(
                     "VIEW_STATE_IDs array length does not match ViewDrawableStates style array");
         }
         int[] orderedIds = new int[.];
         for (int i = 0; i < ...i++) {
             int viewState = ..[i];
             for (int j = 0; j<.j += 2) {
                 if ([j] == viewState) {
                     orderedIds[i * 2] = viewState;
                     orderedIds[i * 2 + 1] = [j + 1];
                 }
             }
         }
         final int NUM_BITS = . / 2;
          = new int[1 << NUM_BITS][];
         for (int i = 0; i < .i++) {
             int numBits = Integer.bitCount(i);
             int[] set = new int[numBits];
             int pos = 0;
             for (int j = 0; j < orderedIds.lengthj += 2) {
                 if ((i & orderedIds[j+1]) != 0) {
                     set[pos++] = orderedIds[j];
                 }
             }
             [i] = set;
         }
          = [0];
                  | ];
                  | ];
                  | ];
                  | 
                 | ];
                  | ];
                  | ];
                  | 
                 | ];
                  | ];
                  | 
                 | ];
                  | 
                 | ];
                  | 
                 | ];
                  | ];
                  | ];
                  | 
                 | ];
                  | ];
                  | 
                 | ];
                  | 
                 | ];
                  | 
                 |  | ];
                  | ];
                  | 
                 | ];
                  | 
                 | ];
                  | 
                 |  | ];
                  | 
                 | ];
                  | 
                 |  | ];
                  | 
                 |  | ];
                  | 
                 | 
                 | ];
     }

    
Accessibility event types that are dispatched for text population.
     private static final int POPULATING_ACCESSIBILITY_EVENT_TYPES =
             .
             | .
             | .
             | .
             | .
             | .
             | .;

    
Temporary Rect currently for use in setBackground(). This will probably be extended in the future to hold our own class with more than just a Rect. :)
     static final ThreadLocal<RectsThreadLocal = new ThreadLocal<Rect>();

    
Map used to store views' tags.
     private SparseArray<ObjectmKeyedTags;

    
The next available accessiiblity id.
     private static int sNextAccessibilityViewId;

    
The animation currently associated with this view.

Hide:
     protected Animation mCurrentAnimation = null;

    
Width as measured during measure pass.
     @ViewDebug.ExportedProperty(category = "measurement")
     int mMeasuredWidth;

    
Height as measured during measure pass.
     @ViewDebug.ExportedProperty(category = "measurement")
     int mMeasuredHeight;

    
Flag to indicate that this view was marked INVALIDATED, or had its display list invalidated, prior to the current drawing iteration. If true, the view must re-draw its display list. This flag, used only when hw accelerated, allows us to clear the flag while retaining this information until it's needed (at getDisplayList() time and in drawChild(), when we decide to draw a view's children's display lists into our own).
     boolean mRecreateDisplayList = false;

    
The view's identifier.

     @ViewDebug.ExportedProperty(resolveId = true)
     int mID = ;

    
The stable ID of this view for accessibility porposes.
     int mAccessibilityViewId = ;

    
The view's tag.

     protected Object mTag;
     // for mPrivateFlags:
     
     static final int WANTS_FOCUS                    = 0x00000001;
    
     static final int FOCUSED                        = 0x00000002;
    
     static final int SELECTED                       = 0x00000004;
    
     static final int IS_ROOT_NAMESPACE              = 0x00000008;
    
     static final int HAS_BOUNDS                     = 0x00000010;
    
     static final int DRAWN                          = 0x00000020;
    
When this flag is set, this view is running an animation on behalf of its children and should therefore not cancel invalidate requests, even if they lie outside of this view's bounds.
     static final int DRAW_ANIMATION                 = 0x00000040;
    
     static final int SKIP_DRAW                      = 0x00000080;
    
     static final int ONLY_DRAWS_BACKGROUND          = 0x00000100;
    
     static final int REQUEST_TRANSPARENT_REGIONS    = 0x00000200;
    
     static final int DRAWABLE_STATE_DIRTY           = 0x00000400;
    
     static final int MEASURED_DIMENSION_SET         = 0x00000800;
    
     static final int FORCE_LAYOUT                   = 0x00001000;
    
     static final int LAYOUT_REQUIRED                = 0x00002000;
     private static final int PRESSED                = 0x00004000;

    
     static final int DRAWING_CACHE_VALID            = 0x00008000;
    
Flag used to indicate that this view should be drawn once more (and only once more) after its animation has completed.
     static final int ANIMATION_STARTED              = 0x00010000;
     private static final int SAVE_STATE_CALLED      = 0x00020000;

    
Indicates that the View returned true when onSetAlpha() was called and that the alpha must be restored.
     static final int ALPHA_SET                      = 0x00040000;

    
     static final int SCROLL_CONTAINER               = 0x00080000;

    
     static final int SCROLL_CONTAINER_ADDED         = 0x00100000;

    
View flag indicating whether this view was invalidated (fully or partially.)

Hide:
     static final int DIRTY                          = 0x00200000;

    
View flag indicating whether this view was invalidated by an opaque invalidate request.

Hide:
     static final int DIRTY_OPAQUE                   = 0x00400000;

    
Mask for DIRTY and DIRTY_OPAQUE.

Hide:
     static final int DIRTY_MASK                     = 0x00600000;

    
Indicates whether the background is opaque.

Hide:
     static final int OPAQUE_BACKGROUND              = 0x00800000;

    
Indicates whether the scrollbars are opaque.

Hide:
     static final int OPAQUE_SCROLLBARS              = 0x01000000;

    
Indicates whether the view is opaque.

Hide:
     static final int OPAQUE_MASK                    = 0x01800000;

    
Indicates a prepressed state; the short time between ACTION_DOWN and recognizing a 'real' press. Prepressed is used to recognize quick taps even when they are shorter than ViewConfiguration.getTapTimeout().

Hide:
     private static final int PREPRESSED             = 0x02000000;

    
Indicates whether the view is temporarily detached.

Hide:
     static final int CANCEL_NEXT_UP_EVENT = 0x04000000;

    
Indicates that we should awaken scroll bars once attached

Hide:
     private static final int AWAKEN_SCROLL_BARS_ON_ATTACH = 0x08000000;

    
Indicates that the view has received HOVER_ENTER. Cleared on HOVER_EXIT.

Hide:
     private static final int HOVERED              = 0x10000000;

    
Indicates that pivotX or pivotY were explicitly set and we should not assume the center for transform operations

Hide:
     private static final int PIVOT_EXPLICITLY_SET = 0x20000000;

    
     static final int ACTIVATED                    = 0x40000000;

    
Indicates that this view was specifically invalidated, not just dirtied because some child view was invalidated. The flag is used to determine when we need to recreate a view's display list (as opposed to just returning a reference to its existing display list).

Hide:
     static final int INVALIDATED                  = 0x80000000;
     /* Masks for mPrivateFlags2 */

    
Indicates that this view has reported that it can accept the current drag's content. Cleared when the drag operation concludes.

Hide:
     static final int DRAG_CAN_ACCEPT              = 0x00000001;

    
Indicates that this view is currently directly under the drag location in a drag-and-drop operation involving content that it can accept. Cleared when the drag exits the view, or when the drag operation concludes.

Hide:
     static final int DRAG_HOVERED                 = 0x00000002;

    
Indicates whether the view layout direction has been resolved and drawn to the right-to-left direction.

Hide:
     static final int LAYOUT_DIRECTION_RESOLVED_RTL = 0x00000004;

    
Indicates whether the view layout direction has been resolved.

Hide:
     static final int LAYOUT_DIRECTION_RESOLVED = 0x00000008;
     /* End of masks for mPrivateFlags2 */
     static final int DRAG_MASK =  | ;

    
Always allow a user to over-scroll this view, provided it is a view that can scroll.

     public static final int OVER_SCROLL_ALWAYS = 0;

    
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.

     public static final int OVER_SCROLL_IF_CONTENT_SCROLLS = 1;

    
Never allow a user to over-scroll this view.

     public static final int OVER_SCROLL_NEVER = 2;

    
View has requested the system UI (status bar) to be visible (the default).

     public static final int SYSTEM_UI_FLAG_VISIBLE = 0;

    
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.

     public static final int SYSTEM_UI_FLAG_LOW_PROFILE = 0x00000001;

    
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.

     public static final int SYSTEM_UI_FLAG_HIDE_NAVIGATION = 0x00000002;

    

Deprecated:
Use SYSTEM_UI_FLAG_LOW_PROFILE instead.
     public static final int STATUS_BAR_HIDDEN = ;

    

Deprecated:
Use SYSTEM_UI_FLAG_VISIBLE instead.
     public static final int STATUS_BAR_VISIBLE = ;

    

Hide:
NOTE: This flag may only be used in subtreeSystemUiVisibility. It is masked out of the public fields to keep the undefined bits out of the developer's way. Flag to make the status bar not expandable. Unless you also set STATUS_BAR_DISABLE_NOTIFICATION_ICONS, new notifications will continue to show.
     public static final int STATUS_BAR_DISABLE_EXPAND = 0x00010000;

    

Hide:
NOTE: This flag may only be used in subtreeSystemUiVisibility. It is masked out of the public fields to keep the undefined bits out of the developer's way. Flag to hide notification icons and scrolling ticker text.
     public static final int STATUS_BAR_DISABLE_NOTIFICATION_ICONS = 0x00020000;

    

Hide:
NOTE: This flag may only be used in subtreeSystemUiVisibility. It is masked out of the public fields to keep the undefined bits out of the developer's way. Flag to disable incoming notification alerts. This will not block icons, but it will block sound, vibrating and other visual or aural notifications.
     public static final int STATUS_BAR_DISABLE_NOTIFICATION_ALERTS = 0x00040000;

    

Hide:
NOTE: This flag may only be used in subtreeSystemUiVisibility. It is masked out of the public fields to keep the undefined bits out of the developer's way. Flag to hide only the scrolling ticker. Note that STATUS_BAR_DISABLE_NOTIFICATION_ICONS implies STATUS_BAR_DISABLE_NOTIFICATION_TICKER.
     public static final int STATUS_BAR_DISABLE_NOTIFICATION_TICKER = 0x00080000;

    

Hide:
NOTE: This flag may only be used in subtreeSystemUiVisibility. It is masked out of the public fields to keep the undefined bits out of the developer's way. Flag to hide the center system info area.
     public static final int STATUS_BAR_DISABLE_SYSTEM_INFO = 0x00100000;

    

Hide:
NOTE: This flag may only be used in subtreeSystemUiVisibility. It is masked out of the public fields to keep the undefined bits out of the developer's way. Flag to hide only the home button. Don't use this unless you're a special part of the system UI (i.e., setup wizard, keyguard).
     public static final int STATUS_BAR_DISABLE_HOME = 0x00200000;

    

Hide:
NOTE: This flag may only be used in subtreeSystemUiVisibility. It is masked out of the public fields to keep the undefined bits out of the developer's way. Flag to hide only the back button. Don't use this unless you're a special part of the system UI (i.e., setup wizard, keyguard).
     public static final int STATUS_BAR_DISABLE_BACK = 0x00400000;

    

Hide:
NOTE: This flag may only be used in subtreeSystemUiVisibility. It is masked out of the public fields to keep the undefined bits out of the developer's way. Flag to hide only the clock. You might use this if your activity has its own clock making the status bar's clock redundant.
     public static final int STATUS_BAR_DISABLE_CLOCK = 0x00800000;

    

Hide:
NOTE: This flag may only be used in subtreeSystemUiVisibility. It is masked out of the public fields to keep the undefined bits out of the developer's way. Flag to hide only the recent apps button. Don't use this unless you're a special part of the system UI (i.e., setup wizard, keyguard).
     public static final int STATUS_BAR_DISABLE_RECENT = 0x01000000;

    

Hide:
NOTE: This flag may only be used in subtreeSystemUiVisibility, etc. etc. This hides HOME and RECENT and is provided for compatibility with interim implementations.
     @Deprecated
     public static final int STATUS_BAR_DISABLE_NAVIGATION = 
              | ;

    

Hide:
     public static final int PUBLIC_STATUS_BAR_VISIBILITY_MASK = 0x0000FFFF;

    
These are the system UI flags that can be cleared by events outside of an application. Currently this is just the ability to tap on the screen while hiding the navigation bar to have it return.

Hide:
     public static final int SYSTEM_UI_CLEARABLE_FLAGS =
              | ;

    
Find views that render the specified text.

     public static final int FIND_VIEWS_WITH_TEXT = 0x00000001;

    
Find find views that contain the specified content description.

     public static final int FIND_VIEWS_WITH_CONTENT_DESCRIPTION = 0x00000002;

    
     private int mOverScrollMode;

    
The parent this view is attached to.

See also:
getParent()
     protected ViewParent mParent;

    
     AttachInfo mAttachInfo;

    
     @ViewDebug.ExportedProperty(flagMapping = {
         @ViewDebug.FlagToString(mask = , equals = ,
                 name = "FORCE_LAYOUT"),
         @ViewDebug.FlagToString(mask = , equals = ,
                 name = "LAYOUT_REQUIRED"),
         @ViewDebug.FlagToString(mask = , equals = ,
             name = "DRAWING_CACHE_INVALID", outputIf = false),
         @ViewDebug.FlagToString(mask = , equals = , name = "DRAWN", outputIf = true),
         @ViewDebug.FlagToString(mask = , equals = , name = "NOT_DRAWN", outputIf = false),
         @ViewDebug.FlagToString(mask = , equals = , name = "DIRTY_OPAQUE"),
         @ViewDebug.FlagToString(mask = , equals = , name = "DIRTY")
     })
     int mPrivateFlags;
     int mPrivateFlags2;

    
This view's request for the visibility of the status bar.

Hide:
     @ViewDebug.ExportedProperty(flagMapping = {
                                 equals = ,
                                 name = "SYSTEM_UI_FLAG_LOW_PROFILE", outputIf = true),
                                 equals = ,
                                 name = "SYSTEM_UI_FLAG_HIDE_NAVIGATION", outputIf = true),
                                 equals = ,
                                 name = "SYSTEM_UI_FLAG_VISIBLE", outputIf = true)
     })
     int mSystemUiVisibility;

    
Count of how many windows this view has been attached to.
     int mWindowAttachCount;

    
The layout parameters associated with this view and used by the parent ViewGroup to determine how this view should be laid out.
     protected ViewGroup.LayoutParams mLayoutParams;

    
The view flags hold various views states.
     int mViewFlags;
     static class TransformationInfo {
        
The transform matrix for the View. This transform is calculated internally based on the rotation, scaleX, and scaleY properties. The identity matrix is used by default. Do *not* use this variable directly; instead call getMatrix(), which will automatically recalculate the matrix if necessary to get the correct matrix based on the latest rotation and scale properties.
         private final Matrix mMatrix = new Matrix();

        
The transform matrix for the View. This transform is calculated internally based on the rotation, scaleX, and scaleY properties. The identity matrix is used by default. Do *not* use this variable directly; instead call getInverseMatrix(), which will automatically recalculate the matrix if necessary to get the correct matrix based on the latest rotation and scale properties.
         private Matrix mInverseMatrix;

        
An internal variable that tracks whether we need to recalculate the transform matrix, based on whether the rotation or scaleX/Y properties have changed since the matrix was last calculated.
         boolean mMatrixDirty = false;

        
An internal variable that tracks whether we need to recalculate the transform matrix, based on whether the rotation or scaleX/Y properties have changed since the matrix was last calculated.
         private boolean mInverseMatrixDirty = true;

        
A variable that tracks whether we need to recalculate the transform matrix, based on whether the rotation or scaleX/Y properties have changed since the matrix was last calculated. This variable is only valid after a call to updateMatrix() or to a function that calls it such as getMatrix(), hasIdentityMatrix() and getInverseMatrix().
         private boolean mMatrixIsIdentity = true;

        
The Camera object is used to compute a 3D matrix when rotationX or rotationY are set.
         private Camera mCamera = null;

        
This matrix is used when computing the matrix for 3D rotations.
         private Matrix matrix3D = null;

        
These prev values are used to recalculate a centered pivot point when necessary. The pivot point is only used in matrix operations (when rotation, scale, or translation are set), so thes values are only used then as well.
         private int mPrevWidth = -1;
         private int mPrevHeight = -1;
        
        
The degrees rotation around the vertical axis through the pivot point.
         @ViewDebug.ExportedProperty
         float mRotationY = 0f;

        
The degrees rotation around the horizontal axis through the pivot point.
         @ViewDebug.ExportedProperty
         float mRotationX = 0f;

        
The degrees rotation around the pivot point.
         @ViewDebug.ExportedProperty
         float mRotation = 0f;

        
The amount of translation of the object away from its left property (post-layout).
         @ViewDebug.ExportedProperty
         float mTranslationX = 0f;

        
The amount of translation of the object away from its top property (post-layout).
         @ViewDebug.ExportedProperty
         float mTranslationY = 0f;

        
The amount of scale in the x direction around the pivot point. A value of 1 means no scaling is applied.
         @ViewDebug.ExportedProperty
         float mScaleX = 1f;

        
The amount of scale in the y direction around the pivot point. A value of 1 means no scaling is applied.
         @ViewDebug.ExportedProperty
         float mScaleY = 1f;

        
The amount of scale in the x direction around the pivot point. A value of 1 means no scaling is applied.
         @ViewDebug.ExportedProperty
         float mPivotX = 0f;

        
The amount of scale in the y direction around the pivot point. A value of 1 means no scaling is applied.
         @ViewDebug.ExportedProperty
         float mPivotY = 0f;

        
The opacity of the View. This is a value from 0 to 1, where 0 means completely transparent and 1 means completely opaque.
         @ViewDebug.ExportedProperty
         float mAlpha = 1f;
     }
     private boolean mLastIsOpaque;

    
Convenience value to check for float values that are close enough to zero to be considered zero.
     private static final float NONZERO_EPSILON = .001f;

    
The distance in pixels from the left edge of this view's parent to the left edge of this view.
     @ViewDebug.ExportedProperty(category = "layout")
     protected int mLeft;
    
The distance in pixels from the left edge of this view's parent to the right edge of this view.
     @ViewDebug.ExportedProperty(category = "layout")
     protected int mRight;
    
The distance in pixels from the top edge of this view's parent to the top edge of this view.
     @ViewDebug.ExportedProperty(category = "layout")
     protected int mTop;
    
The distance in pixels from the top edge of this view's parent to the bottom edge of this view.
     @ViewDebug.ExportedProperty(category = "layout")
     protected int mBottom;

    
The offset, in pixels, by which the content of this view is scrolled horizontally.
     @ViewDebug.ExportedProperty(category = "scrolling")
     protected int mScrollX;
    
The offset, in pixels, by which the content of this view is scrolled vertically.
     @ViewDebug.ExportedProperty(category = "scrolling")
     protected int mScrollY;

    
The left padding in pixels, that is the distance in pixels between the left edge of this view and the left edge of its content.
     @ViewDebug.ExportedProperty(category = "padding")
     protected int mPaddingLeft;
    
The right padding in pixels, that is the distance in pixels between the right edge of this view and the right edge of its content.
     @ViewDebug.ExportedProperty(category = "padding")
     protected int mPaddingRight;
    
The top padding in pixels, that is the distance in pixels between the top edge of this view and the top edge of its content.
     @ViewDebug.ExportedProperty(category = "padding")
     protected int mPaddingTop;
    
The bottom padding in pixels, that is the distance in pixels between the bottom edge of this view and the bottom edge of its content.
     @ViewDebug.ExportedProperty(category = "padding")
     protected int mPaddingBottom;

    
Briefly describes the view and is primarily used for accessibility support.
     private CharSequence mContentDescription;

    
Cache the paddingRight set by the user to append to the scrollbar's size.

Hide:
     @ViewDebug.ExportedProperty(category = "padding")
     protected int mUserPaddingRight;

    
Cache the paddingBottom set by the user to append to the scrollbar's size.

Hide:
     @ViewDebug.ExportedProperty(category = "padding")
     protected int mUserPaddingBottom;

    
Cache the paddingLeft set by the user to append to the scrollbar's size.

Hide:
     @ViewDebug.ExportedProperty(category = "padding")
     protected int mUserPaddingLeft;

    
Cache if the user padding is relative.
     @ViewDebug.ExportedProperty(category = "padding")
     boolean mUserPaddingRelative;

    
Cache the paddingStart set by the user to append to the scrollbar's size.
     @ViewDebug.ExportedProperty(category = "padding")
     int mUserPaddingStart;

    
Cache the paddingEnd set by the user to append to the scrollbar's size.
     @ViewDebug.ExportedProperty(category = "padding")
     int mUserPaddingEnd;

    

Hide:
     int mOldWidthMeasureSpec = .;
    

Hide:
     private Drawable mBGDrawable;
     private int mBackgroundResource;
     private boolean mBackgroundSizeChanged;

    
Listener used to dispatch focus change events. This field should be made private, so it is hidden from the SDK.
     protected OnFocusChangeListener mOnFocusChangeListener;

    
Listeners for layout change events.
Listeners for attach events.
Listener used to dispatch click events. This field should be made private, so it is hidden from the SDK.
     protected OnClickListener mOnClickListener;

    
Listener used to dispatch long click events. This field should be made private, so it is hidden from the SDK.
     protected OnLongClickListener mOnLongClickListener;

    
Listener used to build the context menu. This field should be made private, so it is hidden from the SDK.
     private OnKeyListener mOnKeyListener;
     private OnDragListener mOnDragListener;
The application environment this view lives in. This field should be made private, so it is hidden from the SDK.
     protected Context mContext;
     private final Resources mResources;
     private int[] mDrawableState = null;

    
Set to true when drawing cache is enabled and cannot be created.

Hide:
     public boolean mCachingFailed;
     private Bitmap mDrawingCache;
     private Bitmap mUnscaledDrawingCache;
     private HardwareLayer mHardwareLayer;
     DisplayList mDisplayList;

    
When this view has focus and the next focus is FOCUS_LEFT, the user may specify which view to go to next.
     private int mNextFocusLeftId = .;

    
When this view has focus and the next focus is FOCUS_RIGHT, the user may specify which view to go to next.
     private int mNextFocusRightId = .;

    
When this view has focus and the next focus is FOCUS_UP, the user may specify which view to go to next.
     private int mNextFocusUpId = .;

    
When this view has focus and the next focus is FOCUS_DOWN, the user may specify which view to go to next.
     private int mNextFocusDownId = .;

    
When this view has focus and the next focus is FOCUS_FORWARD, the user may specify which view to go to next.
     int mNextFocusForwardId = .;
     private CheckForTap mPendingCheckForTap = null;
     private PerformClick mPerformClick;
     private UnsetPressedState mUnsetPressedState;

    
Whether the long press's action has been invoked. The tap's action is invoked on the up event while a long press is invoked as soon as the long press duration is reached, so a long press could be performed before the tap is checked, in which case the tap's action should not be invoked.
     private boolean mHasPerformedLongPress;

    
The minimum height of the view. We'll try our best to have the height of this view to at least this amount.
     @ViewDebug.ExportedProperty(category = "measurement")
     private int mMinHeight;

    
The minimum width of the view. We'll try our best to have the width of this view to at least this amount.
     @ViewDebug.ExportedProperty(category = "measurement")
     private int mMinWidth;

    
The delegate to handle touch events that are physically in this view but should be handled by another view.
     private TouchDelegate mTouchDelegate = null;

    
Solid color to use as a background when creating the drawing cache. Enables the cache to use 16 bit bitmaps instead of 32 bit.
     private int mDrawingCacheBackgroundColor = 0;

    
Special tree observer used when mAttachInfo is null.
     private ViewTreeObserver mFloatingTreeObserver;

    
Cache the touch slop from the context that created the view.
     private int mTouchSlop;

    
Object that handles automatic animation of view properties.
     private ViewPropertyAnimator mAnimator = null;

    
Flag indicating that a drag can cross window boundaries. When startDrag(android.content.ClipData,android.view.View.DragShadowBuilder,java.lang.Object,int) is called with this flag set, all visible applications will be able to participate in the drag operation and receive the dragged content.

Hide:
     public static final int DRAG_FLAG_GLOBAL = 1;

    
Vertical scroll factor cached by getVerticalScrollFactor().
     private float mVerticalScrollFactor;

    
Position of the vertical scroll bar.
     private int mVerticalScrollbarPosition;

    
Position the scroll bar at the default position as determined by the system.
     public static final int SCROLLBAR_POSITION_DEFAULT = 0;

    
Position the scroll bar along the left edge.
     public static final int SCROLLBAR_POSITION_LEFT = 1;

    
Position the scroll bar along the right edge.
     public static final int SCROLLBAR_POSITION_RIGHT = 2;

    
     public static final int LAYER_TYPE_NONE = 0;

    

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

     public static final int LAYER_TYPE_SOFTWARE = 1;

    

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.

     public static final int LAYER_TYPE_HARDWARE = 2;
     @ViewDebug.ExportedProperty(category = "drawing", mapping = {
             @ViewDebug.IntToString(from = , to = "NONE"),
             @ViewDebug.IntToString(from = , to = "SOFTWARE"),
             @ViewDebug.IntToString(from = , to = "HARDWARE")
     })
     int mLayerType = ;
     Rect mLocalDirtyRect;

    
Set to true when the view is sending hover accessibility events because it is the innermost hovered view.
     private boolean mSendingHoverAccessibilityEvents;

    
Delegate for injecting accessiblity functionality.
Text direction is inherited thru ViewGroup

Hide:
     public static final int TEXT_DIRECTION_INHERIT = 0;

    
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 ayout direction.

Hide:
     public static final int TEXT_DIRECTION_FIRST_STRONG = 1;

    
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.

Hide:
     public static final int TEXT_DIRECTION_ANY_RTL = 2;

    
Text direction is forced to LTR.

Hide:
     public static final int TEXT_DIRECTION_LTR = 3;

    
Text direction is forced to RTL.

Hide:
     public static final int TEXT_DIRECTION_RTL = 4;

    
Default text direction is inherited

Hide:
     protected static int DEFAULT_TEXT_DIRECTION = ;

    
The text direction that has been defined by setTextDirection(int).
     @ViewDebug.ExportedProperty(category = "text", mapping = {
             @ViewDebug.IntToString(from = , to = "INHERIT"),
             @ViewDebug.IntToString(from = , to = "FIRST_STRONG"),
             @ViewDebug.IntToString(from = , to = "ANY_RTL"),
             @ViewDebug.IntToString(from = , to = "LTR"),
             @ViewDebug.IntToString(from = , to = "RTL")
     })
     private int mTextDirection = ;

    
The resolved text direction. This needs resolution if the value is TEXT_DIRECTION_INHERIT. The resolution matches mTextDirection if that is not TEXT_DIRECTION_INHERIT, otherwise resolution proceeds up the parent chain of the view.
     @ViewDebug.ExportedProperty(category = "text", mapping = {
             @ViewDebug.IntToString(from = , to = "INHERIT"),
             @ViewDebug.IntToString(from = , to = "FIRST_STRONG"),
             @ViewDebug.IntToString(from = , to = "ANY_RTL"),
             @ViewDebug.IntToString(from = , to = "LTR"),
             @ViewDebug.IntToString(from = , to = "RTL")
     })
     private int mResolvedTextDirection = ;

    
Consistency verifier for debugging purposes.

Hide:
             InputEventConsistencyVerifier.isInstrumentationEnabled() ?
                     new InputEventConsistencyVerifier(this, 0) : null;

    
Simple constructor to use when creating a view from code.

Parameters:
context The Context the view is running in, through which it can access the current theme, resources, etc.
     public View(Context context) {
          = context;
          = context != null ? context.getResources() : null;
          = ViewConfiguration.get(context).getScaledTouchSlop();
          = -1;
          = -1;
          = false;
     }

    
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 The Context the view is running in, through which it can access the current theme, resources, etc.
attrs The attributes of the XML tag that is inflating the view.
See also:
View(android.content.Context,android.util.AttributeSet,int)
     public View(Context contextAttributeSet attrs) {
         this(contextattrs, 0);
     }

    
Perform inflation from XML and apply a class-specific base style. 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 defStyle; 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 The Context the view is running in, through which it can access the current theme, resources, etc.
attrs The attributes of the XML tag that is inflating the view.
defStyle The default style to apply to this view. If 0, no style will be applied (beyond what is included in the theme). This may either be an attribute resource, whose value will be retrieved from the current theme, or an explicit style resource.
See also:
View(android.content.Context,android.util.AttributeSet)
     public View(Context contextAttributeSet attrsint defStyle) {
         this(context);
         TypedArray a = context.obtainStyledAttributes(attrs.....,
                 defStyle, 0);
         Drawable background = null;
<