android View全面详解2
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
class | View.AccessibilityDelegate | This class represents a delegate that can be registered in a | |||||||||
class | View.BaseSavedState | Base class for derived classes that want to save and restore their own state inonSaveInstanceState() . | |||||||||
class | View.DragShadowBuilder | Creates an image that the system displays during the drag and drop operation. | |||||||||
class | View.MeasureSpec | A MeasureSpec encapsulates the layout requirements passed from parent to child. | |||||||||
interface | View.OnAttachStateChangeListener | Interface definition for a callback to be invoked when this view is attached or detached from its window. | |||||||||
interface | View.OnClickListener | Interface definition for a callback to be invoked when a view is clicked. | |||||||||
interface | View.OnCreateContextMenuListener | Interface definition for a callback to be invoked when the context menu for this view is being built. | |||||||||
interface | View.OnDragListener | Interface definition for a callback to be invoked when a drag is being dispatched to this view. | |||||||||
interface | View.OnFocusChangeListener | Interface definition for a callback to be invoked when the focus state of a view changed. | |||||||||
interface | View.OnGenericMotionListener | Interface definition for a callback to be invoked when a generic motion event is dispatched to this view. | |||||||||
interface | View.OnHoverListener | Interface definition for a callback to be invoked when a hover(盘旋) event is dispatched to this view. 处理光标悬停的回调.4.0的新特性 | |||||||||
interface | View.OnKeyListener | Interface definition for a callback to be invoked when a key event is dispatched to this view. | |||||||||
interface | View.OnLayoutChangeListener | Interface definition for a callback to be invoked when the layout bounds of a view changes due to layout processing. | |||||||||
interface | View.OnLongClickListener | Interface definition for a callback to be invoked when a view has been clicked and held. | |||||||||
interface | View.OnSystemUiVisibilityChangeListener | Interface definition for a callback to be invoked when the status bar changes visibility. | |||||||||
interface | View.OnTouchListener | Interface definition for a callback to be invoked when a touch event is dispatched to this view. |
上表中的Interface都是一些操作的回调方法.
XML Attributes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Attribute Name | Related Method | Description | |||||||||
android:alpha | setAlpha(float) | alpha property of the view, as a value between 0 (completely transparent(透明的,显然的)) and 1 (completely opaque). | |||||||||
android:background | setBackgroundResource(int) | A drawable to use as the background. 设置背景色/背景图片。可以通过以下两种方法设置背景为透明:"@android:color/transparent"和"@null"。注意TextView默认是透明的,不用写此属性,但是Buttom/ImageButton/ImageView想透明的话就得写这个属性了。 | |||||||||
android:clickable | setClickable(boolean) | Defines whether this view reacts to click events. | |||||||||
android:contentDescription | setContentDescription(CharSequence) | Defines text that briefly describes content of the view. 设置View的备注说明,作为一种辅助功能提供,为一些没有文字描述的View提供说明,如ImageButton。这里在界面上不会有效果,自己在程序中控制,可临时放一点字符串数据。 | |||||||||
android:drawingCacheQuality | setDrawingCacheQuality(int) | Defines the quality of translucent(透明的,半透明的) drawing caches. 设置绘图时半透明质量。有以下值可设置:auto(默认,由框架决定)/high(高质量,使用较高的颜色深度,消耗更多的内存/low(低质量,使用较低的颜色深度,但是用更少的内存)。 | |||||||||
android:duplicateParentState | When this attribute is set to true, the view gets its drawable state (focused, pressed, etc.) from its direct parent rather than from itself. | ||||||||||
android:fadingEdgeLength | getVerticalFadingEdgeLength() | Defines the length of the fading edges. 还有一个属性:android:fadingEdge , 不知道怎么没写, 是忘写了还是怎么的,文档没有,但是可以设置出来.网上的说明为:设置拉滚动条时 ,边框渐变的放向。none(边框颜色不变),horizontal(水平方向颜色变淡),vertical(垂直方向颜色变淡)。参照fadingEdgeLength的效果图 不知道怎么回事, 我设置这两个属性没有效果,难道是要拉滚动条什么的? 网上的该属性效果:设置边框渐变的长度。 | |||||||||
android:filterTouchesWhenObscured | setFilterTouchesWhenObscured(boolean) | Specifies whether to filter touches when the view's window is obscured by another visible window. | |||||||||
android:fitsSystemWindows | setFitsSystemWindows(boolean) | Boolean internal attribute to adjust view layout based on system windows such as the status bar. | |||||||||
android:focusable | setFocusable(boolean) | Boolean that controls whether a view can take focus. | |||||||||
android:focusableInTouchMode | setFocusableInTouchMode(boolean) | Boolean that controls whether a view can take focus while in touch mode. | |||||||||
android:hapticFeedbackEnabled | setHapticFeedbackEnabled(boolean) | Boolean that controls whether a view should have haptic(触觉的) feedback enabled for events such as long presses. | |||||||||
android:id | setId(int) | Supply an identifier name for this view, to later retrieve it withView.findViewById() orActivity.findViewById() . | |||||||||
android:isScrollContainer | Set this if the view will serve as a scrolling container, meaing that it can be resized to shrink its overall window so that there will be space for an input method. | ||||||||||
android:keepScreenOn | setKeepScreenOn(boolean) | Controls whether the view's window should keep the screen on while visible. | |||||||||
android:layerType | setLayerType(int,Paint) | Specifies the type of layer backing this view. | |||||||||
android:longClickable | setLongClickable(boolean) | Defines whether this view reacts to long click events. | |||||||||
android:minHeight | Defines the minimum height of the view. | ||||||||||
android:minWidth | Defines the minimum width of the view. | ||||||||||
android:nextFocusDown | setNextFocusDownId(int) | Defines the next view to give focus to when the next focus isFOCUS_DOWN If the reference refers to a view that does not exist or is part of a hierarchy that is invisible, aRuntimeException will result when the reference is accessed. | |||||||||
android:nextFocusForward | setNextFocusForwardId(int) | Defines the next view to give focus to when the next focus isFOCUS_FORWARD If the reference refers to a view that does not exist or is part of a hierarchy that is invisible, aRuntimeException will result when the reference is accessed. | |||||||||
android:nextFocusLeft | setNextFocusLeftId(int) | Defines the next view to give focus to when the next focus isFOCUS_LEFT . | |||||||||
android:nextFocusRight | setNextFocusRightId(int) | Defines the next view to give focus to when the next focus isFOCUS_RIGHT If the reference refers to a view that does not exist or is part of a hierarchy that is invisible, aRuntimeException will result when the reference is accessed. | |||||||||
android:nextFocusUp | setNextFocusUpId(int) | Defines the next view to give focus to when the next focus isFOCUS_UP If the reference refers to a view that does not exist or is part of a hierarchy that is invisible, aRuntimeException will result when the reference is accessed. | |||||||||
android:onClick | Name of the method in this View's context to invoke when the view is clicked. | ||||||||||
android:padding | setPadding(int,int,int,int) | Sets the padding, in pixels, of all four edges. | |||||||||
android:paddingBottom | setPadding(int,int,int,int) | Sets the padding, in pixels, of the bottom edge; seepadding . | |||||||||
android:paddingLeft | setPadding(int,int,int,int) | Sets the padding, in pixels, of the left edge; seepadding . | |||||||||
android:paddingRight | setPadding(int,int,int,int) | Sets the padding, in pixels, of the right edge; seepadding . | |||||||||
android:paddingTop | setPadding(int,int,int,int) | Sets the padding, in pixels, of the top edge; seepadding . | |||||||||
android:requiresFadingEdge | setVerticalFadingEdgeEnabled(boolean) | Defines which edges should be faded on scrolling. | |||||||||
android:rotation | setRotation(float) | rotation of the view, in degrees. | |||||||||
android:rotationX | setRotationX(float) | rotation of the view around the x axis, in degrees. | |||||||||
android:rotationY | setRotationY(float) | rotation of the view around the y axis, in degrees. | |||||||||
android:saveEnabled | setSaveEnabled(boolean) | If unset, no state will be saved for this view when it is being frozen. | |||||||||
android:scaleX | setScaleX(float) | scale of the view in the x direction. | |||||||||
android:scaleY | setScaleY(float) | scale of the view in the y direction. | |||||||||
android:scrollX | The initial horizontal scroll offset, in pixels. | ||||||||||
android:scrollY | The initial vertical scroll offset, in pixels. | ||||||||||
android:scrollbarAlwaysDrawHorizontalTrack | Defines whether the horizontal scrollbar track should always be drawn. | ||||||||||
android:scrollbarAlwaysDrawVerticalTrack | Defines whether the vertical scrollbar track should always be drawn. | ||||||||||
android:scrollbarDefaultDelayBeforeFade | Defines the delay in milliseconds that a scrollbar waits before fade out. | ||||||||||
android:scrollbarFadeDuration | Defines the delay in milliseconds that a scrollbar takes to fade out. | ||||||||||
android:scrollbarSize | Sets the width of vertical scrollbars and height of horizontal scrollbars. | ||||||||||
android:scrollbarStyle | Controls the scrollbar style and position. | ||||||||||
android:scrollbarThumbHorizontal | Defines the horizontal scrollbar thumb drawable. | ||||||||||
android:scrollbarThumbVertical | Defines the vertical scrollbar thumb drawable. | ||||||||||
android:scrollbarTrackHorizontal | Defines the horizontal scrollbar track drawable. | ||||||||||
android:scrollbarTrackVertical | Defines the vertical scrollbar track drawable. | ||||||||||
android:scrollbars | Defines which scrollbars should be displayed on scrolling or not. | ||||||||||
android:soundEffectsEnabled | setSoundEffectsEnabled(boolean) | Boolean that controls whether a view should have sound effects enabled for events such as clicking and touching. | |||||||||
android:tag | 这里怎么没写setTag()? | Supply a tag for this view containing a String, to be retrieved later withView.getTag() or searched for withView.findViewWithTag() . | |||||||||
android:transformPivotX | setPivotX(float) | x location of the pivot point around which the view will rotate and scale. | |||||||||
android:transformPivotY | setPivotY(float) | y location of the pivot point around which the view will rotate and scale. | |||||||||
android:translationX | setTranslationX(float) | translation in x of the view. | |||||||||
android:translationY | setTranslationY(float) | translation in y of the view. | |||||||||
android:visibility | setVisibility(int) | Controls the initial visibility of the view. |
从这里也可以看出上文说的, 有pading, 没有margin, 去eclise里试了一下, 有margin, 是layout_margin, layout定义的是在父容器的位置.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | DRAWING_CACHE_QUALITY_AUTO | Enables automatic quality mode for the drawing cache. | |||||||||
int | DRAWING_CACHE_QUALITY_HIGH | Enables high quality mode for the drawing cache. | |||||||||
int | DRAWING_CACHE_QUALITY_LOW | Enables low quality mode for the drawing cache. | |||||||||
int | FIND_VIEWS_WITH_CONTENT_DESCRIPTION | Find find views that contain the specified content description. | |||||||||
int | FIND_VIEWS_WITH_TEXT | Find views that render the specified text. | |||||||||
int | FOCUSABLES_ALL | View flag indicating whether, int, int)">addFocusables(ArrayList, int, int) should add all focusable Views regardless if they are focusable in touch mode. | |||||||||
int | FOCUSABLES_TOUCH_MODE | View flag indicating whether, int, int)">addFocusables(ArrayList, int, int) should add only Views focusable in touch mode. | |||||||||
int | FOCUS_BACKWARD | Use withfocusSearch(int) . | |||||||||
int | FOCUS_DOWN | Use withfocusSearch(int) . | |||||||||
int | FOCUS_FORWARD | Use withfocusSearch(int) . | |||||||||
int | FOCUS_LEFT | Use withfocusSearch(int) . | |||||||||
int | FOCUS_RIGHT | Use withfocusSearch(int) . | |||||||||
int | FOCUS_UP | Use withfocusSearch(int) . | |||||||||
int | GONE | This view is invisible, and it doesn't take any space for layout purposes. | |||||||||
int | HAPTIC_FEEDBACK_ENABLED | View flag indicating whether this view should have haptic feedback enabled for events such as long presses. | |||||||||
int | INVISIBLE | This view is invisible, but it still takes up space for layout purposes. | |||||||||
int | KEEP_SCREEN_ON | View flag indicating that the screen should remain on while the window containing this view is visible to the user. | |||||||||
int | LAYER_TYPE_HARDWARE | Indicates that the view has a hardware layer. 如果应用被硬加速了,view会被绘制到一个硬件纹理中.如果应用没被硬加速,此类型的layer的行为同于LAYER_TYPE_SOFTWARE. | |||||||||
int | LAYER_TYPE_NONE | Indicates that the view does not have a layer. view按一般方式绘制,不使用离屏缓冲.这是默认的行为. | |||||||||
int | LAYER_TYPE_SOFTWARE | Indicates that the view has a software layer. view被绘制到一个bitmap中. | |||||||||
int | MEASURED_HEIGHT_STATE_SHIFT | Bit shift ofMEASURED_STATE_MASK to get to the height bits for functions that combine both width and height into a single int, such asgetMeasuredState() and the childState argument ofresolveSizeAndState(int, int, int) . | |||||||||
int | MEASURED_SIZE_MASK | Bits ofgetMeasuredWidthAndState() andgetMeasuredWidthAndState() that provide the actual measured size. | |||||||||
int | MEASURED_STATE_MASK | Bits ofgetMeasuredWidthAndState() andgetMeasuredWidthAndState() that provide the additional state bits. | |||||||||
int | MEASURED_STATE_TOO_SMALL | Bit ofgetMeasuredWidthAndState() andgetMeasuredWidthAndState() that indicates the measured size is smaller that the space the view would like to have. | |||||||||
int | NO_ID | Used to mark a View that has no ID. | |||||||||
int | OVER_SCROLL_ALWAYS | Always allow a user to over-scroll this view, provided it is a view that can scroll. | |||||||||
int | OVER_SCROLL_IF_CONTENT_SCROLLS | Allow a user to over-scroll this view only if the content is large enough to meaningfully scroll, provided it is a view that can scroll. | |||||||||
int | OVER_SCROLL_NEVER | Never allow a user to over-scroll this view. | |||||||||
int | SCROLLBARS_INSIDE_INSET | The scrollbar style to display the scrollbars inside the padded area, increasing the padding of the view. | |||||||||
int | SCROLLBARS_INSIDE_OVERLAY | The scrollbar style to display the scrollbars inside the content area, without increasing the padding. | |||||||||
int | SCROLLBARS_OUTSIDE_INSET | The scrollbar style to display the scrollbars at the edge of the view, increasing the padding of the view. | |||||||||
int | SCROLLBARS_OUTSIDE_OVERLAY | The scrollbar style to display the scrollbars at the edge of the view, without increasing the padding. | |||||||||
int | SCROLLBAR_POSITION_DEFAULT | Position the scroll bar at the default position as determined by the system. | |||||||||
int | SCROLLBAR_POSITION_LEFT | Position the scroll bar along the left edge. | |||||||||
int | SCROLLBAR_POSITION_RIGHT | Position the scroll bar along the right edge. | |||||||||
int | SOUND_EFFECTS_ENABLED | View flag indicating whether this view should have sound effects enabled for events such as clicking and touching. | |||||||||
int | STATUS_BAR_HIDDEN | This constant is deprecated. UseSYSTEM_UI_FLAG_LOW_PROFILE instead. | |||||||||
int | STATUS_BAR_VISIBLE | This constant is deprecated. UseSYSTEM_UI_FLAG_VISIBLE instead. | |||||||||
int | SYSTEM_UI_FLAG_HIDE_NAVIGATION | View has requested that the system navigation be temporarily hidden. | |||||||||
int | SYSTEM_UI_FLAG_LOW_PROFILE | View has requested the system UI to enter an unobtrusive "low profile" mode. | |||||||||
int | SYSTEM_UI_FLAG_VISIBLE | View has requested the system UI (status bar) to be visible (the default). | |||||||||
String | VIEW_LOG_TAG | The logging tag used by this class with android.util.Log. | |||||||||
int | VISIBLE | This view is visible. |
从这向下还没有看, 以后再看吧. Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
View(Contextcontext) Simple constructor to use when creating a view from code. | |||||||||||
View(Contextcontext,AttributeSetattrs) Constructor that is called when inflating a view from XML. | |||||||||||
View(Contextcontext,AttributeSetattrs, int defStyle) Perform inflation from XML and apply a class-specific base style. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void | , int)">addFocusables(ArrayList<View> views, int direction) Add any focusable views that are descendants of this view (possibly including this view if it is focusable itself) to views. | ||||||||||
void | , int, int)">addFocusables(ArrayList<View> views, int direction, int focusableMode) Adds any focusable views that are descendants of this view (possibly including this view if it is focusable itself) to views. | ||||||||||
void | addOnAttachStateChangeListener(View.OnAttachStateChangeListenerlistener) Add a listener for attach state changes. | ||||||||||
void | addOnLayoutChangeListener(View.OnLayoutChangeListenerlistener) Add a listener that will be called when the bounds of the view change due to layout processing. | ||||||||||
void | )">addTouchables(ArrayList<View> views) Add any touchable views that are descendants of this view (possibly including this view if it is touchable itself) to views. | ||||||||||
ViewPropertyAnimator | animate() This method returns a ViewPropertyAnimator object, which can be used to animate specific properties on this View. | ||||||||||
void | bringToFront() Change the view's z order in the tree, so it's on top of other sibling views | ||||||||||
void | buildDrawingCache(boolean autoScale) Forces the drawing cache to be built if the drawing cache is invalid. | ||||||||||
void | buildDrawingCache() Calling this method is equivalent to calling | ||||||||||
void | buildLayer() Forces this view's layer to be created and this view to be rendered into its layer. | ||||||||||
boolean | callOnClick() Directly call any attached OnClickListener. | ||||||||||
boolean | canScrollHorizontally(int direction) Check if this view can be scrolled horizontally in a certain direction. | ||||||||||
boolean | canScrollVertically(int direction) Check if this view can be scrolled vertically in a certain direction. | ||||||||||
void | cancelLongPress() Cancels a pending long press. | ||||||||||
boolean | checkInputConnectionProxy(Viewview) Called by the InputMethodManager when a view who is not the current input connection target is trying to make a call on the manager. | ||||||||||
void | clearAnimation() Cancels any animations for this view. | ||||||||||
void | clearFocus() Called when this view wants to give up focus. | ||||||||||
static int | combineMeasuredStates(int curState, int newState) Merge two states as returned by getMeasuredState() . | ||||||||||
void | computeScroll() Called by a parent to request that a child update its values for mScrollX and mScrollY if necessary. | ||||||||||
AccessibilityNodeInfo | createAccessibilityNodeInfo() Returns an AccessibilityNodeInfo representing this view from the point of view of an AccessibilityService . | ||||||||||
void | createContextMenu(ContextMenumenu) Show the context menu for this view. | ||||||||||
void | destroyDrawingCache() Frees the resources used by the drawing cache. | ||||||||||
void | dispatchConfigurationChanged(ConfigurationnewConfig) Dispatch a notification about a resource configuration change down the view hierarchy. | ||||||||||
void | dispatchDisplayHint(int hint) Dispatch a hint about whether this view is displayed. | ||||||||||
boolean | dispatchDragEvent(DragEventevent) Detects if this View is enabled and has a drag event listener. | ||||||||||
boolean | dispatchGenericMotionEvent(MotionEventevent) Dispatch a generic motion event. | ||||||||||
boolean | dispatchKeyEvent(KeyEventevent) Dispatch a key event to the next view on the focus path. | ||||||||||
boolean | dispatchKeyEventPreIme(KeyEventevent) Dispatch a key event before it is processed by any input method associated with the view hierarchy. | ||||||||||
boolean | dispatchKeyShortcutEvent(KeyEventevent) Dispatches a key shortcut event. | ||||||||||
boolean | dispatchPopulateAccessibilityEvent(AccessibilityEventevent) Dispatches an AccessibilityEvent to the View first and then to its children for adding their text content to the event. | ||||||||||
void | dispatchSystemUiVisibilityChanged(int visibility) Dispatch callbacks to setOnSystemUiVisibilityChangeListener(View.OnSystemUiVisibilityChangeListener) down the view hierarchy. | ||||||||||
boolean | dispatchTouchEvent(MotionEventevent) Pass the touch screen motion event down to the target view, or this view if it is the target. | ||||||||||
boolean | dispatchTrackballEvent(MotionEventevent) Pass a trackball motion event down to the focused view. | ||||||||||
boolean | dispatchUnhandledMove(Viewfocused, int direction) This method is the last chance for the focused view and its ancestors to respond to an arrow key. | ||||||||||
void | dispatchWindowFocusChanged(boolean hasFocus) Called when the window containing this view gains or loses window focus. | ||||||||||
void | dispatchWindowVisibilityChanged(int visibility) Dispatch a window visibility change down the view hierarchy. | ||||||||||
void | draw(Canvascanvas) Manually render this view (and all of its children) to the given Canvas. | ||||||||||
View | findFocus() Find the view in the hierarchy rooted at this view that currently has focus. | ||||||||||
finalView | findViewById(int id) Look for a child view with the given id. | ||||||||||
finalView | findViewWithTag(Objecttag) Look for a child view with the given tag. | ||||||||||
void | , java.lang.CharSequence, int)">findViewsWithText(ArrayList<View> outViews,CharSequencesearched, int flags) Finds the Views that contain given text. | ||||||||||
boolean | fitsSystemWindows() Check for the FITS_SYSTEM_WINDOWS flag. | ||||||||||
View | focusSearch(int direction) Find the nearest view in the specified direction that can take focus. | ||||||||||
void | forceLayout() Forces this view to be laid out during the next layout pass. | ||||||||||
float | getAlpha() The opacity of the view. | ||||||||||
Animation | getAnimation() Get the animation currently associated with this view. | ||||||||||
IBinder | getApplicationWindowToken() Retrieve a unique token identifying the top-level "real" window of the window that this view is attached to. | ||||||||||
Drawable | getBackground() Gets the background drawable | ||||||||||
int | getBaseline() Return the offset of the widget's text baseline from the widget's top boundary. | ||||||||||
final int | getBottom() Bottom position of this view relative to its parent. | ||||||||||
CharSequence | getContentDescription() Gets the View description. | ||||||||||
finalContext | getContext() Returns the context the view is running in, through which it can access the current theme, resources, etc. | ||||||||||
static int | getDefaultSize(int size, int measureSpec) Utility to return a default size. | ||||||||||
final int[] | getDrawableState() Return an array of resource IDs of the drawable states representing the current state of the view. | ||||||||||
Bitmap | getDrawingCache(boolean autoScale) Returns the bitmap in which this view drawing is cached. | ||||||||||
Bitmap | getDrawingCache() Calling this method is equivalent to calling | ||||||||||
int | getDrawingCacheBackgroundColor() | ||||||||||
int | getDrawingCacheQuality() Returns the quality of the drawing cache. | ||||||||||
void | getDrawingRect(RectoutRect) Return the visible drawing bounds of your view. | ||||||||||
long | getDrawingTime() Return the time at which the drawing of the view hierarchy started. | ||||||||||
boolean | getFilterTouchesWhenObscured() Gets whether the framework should discard touches when the view's window is obscured by another visible window. | ||||||||||
ArrayList<View> | getFocusables(int direction) Find and return all focusable views that are descendants of this view, possibly including this view if it is focusable itself. | ||||||||||
void | getFocusedRect(Rectr) When a view has focus and the user navigates away from it, the next view is searched for starting from the rectangle filled in by this method. | ||||||||||
boolean | getGlobalVisibleRect(Rectr,PointglobalOffset) If some part of this view is not clipped by any of its parents, then return that area in r in global (root) coordinates. | ||||||||||
final boolean | getGlobalVisibleRect(Rectr) | ||||||||||
Handler | getHandler() | ||||||||||
final int | getHeight() Return the height of your view. | ||||||||||
void | getHitRect(RectoutRect) Hit rectangle in parent's coordinates | ||||||||||
int | getHorizontalFadingEdgeLength() Returns the size of the horizontal faded edges used to indicate that more content in this view is visible. | ||||||||||
int | getId() Returns this view's identifier. | ||||||||||
boolean | getKeepScreenOn() Returns whether the screen should remain on, corresponding to the current value of KEEP_SCREEN_ON . | ||||||||||
KeyEvent.DispatcherState | getKeyDispatcherState() Return the global KeyEvent.DispatcherState for this view's window. | ||||||||||
int | getLayerType() Indicates what type of layer is currently associated with this view. | ||||||||||
ViewGroup.LayoutParams | getLayoutParams() Get the LayoutParams associated with this view. | ||||||||||
final int | getLeft() Left position of this view relative to its parent. | ||||||||||
final boolean | getLocalVisibleRect(Rectr) | ||||||||||
void | getLocationInWindow(int[] location) Computes the coordinates of this view in its window. | ||||||||||
void | getLocationOnScreen(int[] location) Computes the coordinates of this view on the screen. | ||||||||||
Matrix | getMatrix() The transform matrix of this view, which is calculated based on the current roation, scale, and pivot properties. | ||||||||||
final int | getMeasuredHeight() Like getMeasuredHeightAndState() , but only returns the raw width component (that is the result is masked by MEASURED_SIZE_MASK ). | ||||||||||
final int | getMeasuredHeightAndState() Return the full height measurement information for this view as computed by the most recent call to measure(int, int) . | ||||||||||
final int | getMeasuredState() Return only the state bits of getMeasuredWidthAndState() and getMeasuredHeightAndState() , combined into one integer. | ||||||||||
final int | getMeasuredWidth() Like getMeasuredWidthAndState() , but only returns the raw width component (that is the result is masked by MEASURED_SIZE_MASK ). | ||||||||||
final int | getMeasuredWidthAndState() Return the full width measurement information for this view as computed by the most recent call to measure(int, int) . | ||||||||||
int | getNextFocusDownId() Gets the id of the view to use when the next focus is FOCUS_DOWN . | ||||||||||
int | getNextFocusForwardId() Gets the id of the view to use when the next focus is FOCUS_FORWARD . | ||||||||||
int | getNextFocusLeftId() Gets the id of the view to use when the next focus is FOCUS_LEFT . | ||||||||||
int | getNextFocusRightId() Gets the id of the view to use when the next focus is FOCUS_RIGHT . | ||||||||||
int | getNextFocusUpId() Gets the id of the view to use when the next focus is FOCUS_UP . | ||||||||||
View.OnFocusChangeListener | getOnFocusChangeListener() Returns the focus-change callback registered for this view. | ||||||||||
int | getOverScrollMode() Returns the over-scroll mode for this view. | ||||||||||
int | getPaddingBottom() Returns the bottom padding of this view. | ||||||||||
int | getPaddingLeft() Returns the left padding of this view. | ||||||||||
int | getPaddingRight() Returns the right padding of this view. | ||||||||||
int | getPaddingTop() Returns the top padding of this view. | ||||||||||
finalViewParent | getParent() Gets the parent of this view. | ||||||||||
float | getPivotX() The x location of the point around which the view is rotated and scaled . | ||||||||||
float | getPivotY() The y location of the point around which the view is rotated and scaled . | ||||||||||
abstract int | getResolvedLayoutDirection(Drawablewho) A Drawable can call this to get the resolved layout direction of the who. | ||||||||||
Resources | getResources() Returns the resources associated with this view. | ||||||||||
final int | getRight() Right position of this view relative to its parent. | ||||||||||
View | getRootView() Finds the topmost view in the current view hierarchy. | ||||||||||
float | getRotation() The degrees that the view is rotated around the pivot point. | ||||||||||
float | getRotationX() The degrees that the view is rotated around the horizontal axis through the pivot point. | ||||||||||
float | getRotationY() The degrees that the view is rotated around the vertical axis through the pivot point. | ||||||||||
float | getScaleX() The amount that the view is scaled in x around the pivot point, as a proportion of the view's unscaled width. | ||||||||||
float | getScaleY() The amount that the view is scaled in y around the pivot point, as a proportion of the view's unscaled height. | ||||||||||
int | getScrollBarStyle() Returns the current scrollbar style. | ||||||||||
final int | getScrollX() Return the scrolled left position of this view. | ||||||||||
final int | getScrollY() Return the scrolled top position of this view. | ||||||||||
int | getSolidColor() Override this if your view is known to always be drawn on top of a solid color background, and needs to draw fading edges. | ||||||||||
int | getSystemUiVisibility() Returns the status bar visibility that this view has requested. | ||||||||||
Object | getTag(int key) Returns the tag associated with this view and the specified key. | ||||||||||
Object | getTag() Returns this view's tag. | ||||||||||
final int | getTop() Top position of this view relative to its parent. | ||||||||||
TouchDelegate | getTouchDelegate() Gets the TouchDelegate for this View. | ||||||||||
ArrayList<View> | getTouchables() Find and return all touchable views that are descendants of this view, possibly including this view if it is touchable itself. | ||||||||||
float | getTranslationX() The horizontal location of this view relative to its left position. | ||||||||||
float | getTranslationY() The horizontal location of this view relative to its top position. | ||||||||||
int | getVerticalFadingEdgeLength() Returns the size of the vertical faded edges used to indicate that more content in this view is visible. | ||||||||||
int | getVerticalScrollbarPosition() | ||||||||||
int | getVerticalScrollbarWidth() Returns the width of the vertical scrollbar. | ||||||||||
ViewTreeObserver | getViewTreeObserver() Returns the ViewTreeObserver for this view's hierarchy. | ||||||||||
int | getVisibility() Returns the visibility status for this view. | ||||||||||
final int | getWidth() Return the width of the your view. | ||||||||||
IBinder | getWindowToken() Retrieve a unique token identifying the window this view is attached to. | ||||||||||
int | getWindowVisibility() Returns the current visibility of the window this view is attached to (either GONE , INVISIBLE , or VISIBLE ). | ||||||||||
void | getWindowVisibleDisplayFrame(RectoutRect) Retrieve the overall visible display size in which the window this view is attached to has been positioned in. | ||||||||||
float | getX() The visual x position of this view, in pixels. | ||||||||||
float | getY() The visual y position of this view, in pixels. | ||||||||||
boolean | hasFocus() Returns true if this view has focus iteself, or is the ancestor of the view that has focus. | ||||||||||
boolean | hasFocusable() Returns true if this view is focusable or if it contains a reachable View for which hasFocusable() returns true. | ||||||||||
boolean | hasOnClickListeners() Return whether this view has an attached OnClickListener. | ||||||||||
boolean | hasWindowFocus() Returns true if this view is in a window that currently has window focus. | ||||||||||
staticView | inflate(Contextcontext, int resource,ViewGrouproot) Inflate a view from an XML resource. | ||||||||||
void | invalidate(Rectdirty) Mark the area defined by dirty as needing to be drawn. | ||||||||||
void | invalidate(int l, int t, int r, int b) Mark the area defined by the rect (l,t,r,b) as needing to be drawn. | ||||||||||
void | invalidate() Invalidate the whole view. | ||||||||||
void | invalidateDrawable(Drawabledrawable) Invalidates the specified Drawable. | ||||||||||
boolean | isActivated() Indicates the activation state of this view. | ||||||||||
boolean | isClickable() Indicates whether this view reacts to click events or not. | ||||||||||
boolean | isDirty() True if this view has changed since the last time being drawn. | ||||||||||
boolean | isDrawingCacheEnabled() Indicates whether the drawing cache is enabled for this view. | ||||||||||
boolean | isDuplicateParentStateEnabled() Indicates whether this duplicates its drawable state from its parent. | ||||||||||
boolean | isEnabled() Returns the enabled status for this view. | ||||||||||
final boolean | isFocusable() Returns whether this View is able to take focus. | ||||||||||
final boolean | isFocusableInTouchMode() When a view is focusable, it may not want to take focus when in touch mode. | ||||||||||
boolean | isFocused() Returns true if this view has focus | ||||||||||
boolean | isHapticFeedbackEnabled() | ||||||||||
boolean | isHardwareAccelerated() Indicates whether this view is attached to an hardware accelerated window or not. | ||||||||||
boolean | isHorizontalFadingEdgeEnabled() Indicate whether the horizontal edges are faded when the view is scrolled horizontally. | ||||||||||
boolean | isHorizontalScrollBarEnabled() Indicate whether the horizontal scrollbar should be drawn or not. | ||||||||||
boolean | isHovered() Returns true if the view is currently hovered. | ||||||||||
boolean | isInEditMode() Indicates whether this View is currently in edit mode. | ||||||||||
boolean | isInTouchMode() Returns whether the device is currently in touch mode. | ||||||||||
boolean | isLayoutRequested() Indicates whether or not this view's layout will be requested during the next hierarchy layout pass. | ||||||||||
boolean | isLongClickable() Indicates whether this view reacts to long click events or not. | ||||||||||
boolean | isOpaque() Indicates whether this View is opaque. | ||||||||||
boolean | isPressed() Indicates whether the view is currently in pressed state. | ||||||||||
boolean | isSaveEnabled() Indicates whether this view will save its state (that is, whether its onSaveInstanceState() method will be called). | ||||||||||
boolean | isSaveFromParentEnabled() Indicates whether the entire hierarchy under this view will save its state when a state saving traversal occurs from its parent. | ||||||||||
boolean | isScrollbarFadingEnabled() Returns true if scrollbars will fade when this view is not scrolling | ||||||||||
boolean | isSelected() Indicates the selection state of this view. | ||||||||||
boolean | isShown() Returns the visibility of this view and all of its ancestors | ||||||||||
boolean | isSoundEffectsEnabled() | ||||||||||
boolean | isVerticalFadingEdgeEnabled() Indicate whether the vertical edges are faded when the view is scrolled horizontally. | ||||||||||
boolean | isVerticalScrollBarEnabled() Indicate whether the vertical scrollbar should be drawn or not. | ||||||||||
void | jumpDrawablesToCurrentState() Call Drawable.jumpToCurrentState() on all Drawable objects associated with this view. | ||||||||||
void | layout(int l, int t, int r, int b) Assign a size and position to a view and all of its descendants This is the second phase of the layout mechanism. | ||||||||||
final void | measure(int widthMeasureSpec, int heightMeasureSpec) This is called to find out how big a view should be. | ||||||||||
void | offsetLeftAndRight(int offset) Offset this view's horizontal location by the specified amount of pixels. | ||||||||||
void | offsetTopAndBottom(int offset) Offset this view's vertical location by the specified number of pixels. | ||||||||||
boolean | onCheckIsTextEditor() Check whether the called view is a text editor, in which case it would make sense to automatically display a soft input window for it. | ||||||||||
InputConnection | onCreateInputConnection(EditorInfooutAttrs) Create a new InputConnection for an InputMethod to interact with the view. | ||||||||||
boolean | onDragEvent(DragEventevent) Handles drag events sent by the system following a call to startDrag() . | ||||||||||
boolean | onFilterTouchEventForSecurity(MotionEventevent) Filter the touch event to apply security policies. | ||||||||||
void | onFinishTemporaryDetach() Called after onStartTemporaryDetach() when the container is done changing the view. | ||||||||||
boolean | onGenericMotionEvent(MotionEventevent) Implement this method to handle generic motion events. | ||||||||||
void | onHoverChanged(boolean hovered) Implement this method to handle hover state changes. | ||||||||||
boolean | onHoverEvent(MotionEventevent) Implement this method to handle hover events. | ||||||||||
void | onInitializeAccessibilityEvent(AccessibilityEventevent) Initializes an AccessibilityEvent with information about this View which is the event source. | ||||||||||
void | onInitializeAccessibilityNodeInfo(AccessibilityNodeInfoinfo) Initializes an AccessibilityNodeInfo with information about this view. | ||||||||||
boolean | onKeyDown(int keyCode,KeyEventevent) Default implementation of KeyEvent.Callback.onKeyDown() : perform press of the view when KEYCODE_DPAD_CENTER or KEYCODE_ENTER is released, if the view is enabled and clickable. | ||||||||||
boolean | onKeyLongPress(int keyCode,KeyEventevent) Default implementation of KeyEvent.Callback.onKeyLongPress() : always returns false (doesn't handle the event). | ||||||||||
boolean | onKeyMultiple(int keyCode, int repeatCount,KeyEventevent) Default implementation of KeyEvent.Callback.onKeyMultiple() : always returns false (doesn't handle the event). | ||||||||||
boolean | onKeyPreIme(int keyCode,KeyEventevent) Handle a key event before it is processed by any input method associated with the view hierarchy. | ||||||||||
boolean | onKeyShortcut(int keyCode,KeyEventevent) Called on the focused view when a key shortcut event is not handled. | ||||||||||
boolean | onKeyUp(int keyCode,KeyEventevent) Default implementation of KeyEvent.Callback.onKeyUp() : perform clicking of the view when KEYCODE_DPAD_CENTER or KEYCODE_ENTER is released. | ||||||||||
void | onPopulateAccessibilityEvent(AccessibilityEventevent) Called from dispatchPopulateAccessibilityEvent(AccessibilityEvent) giving a chance to this View to populate the accessibility event with its text content. | ||||||||||
void | onStartTemporaryDetach() This is called when a container is going to temporarily detach a child, with ViewGroup.detachViewFromParent . | ||||||||||
boolean | onTouchEvent(MotionEventevent) Implement this method to handle touch screen motion events. | ||||||||||
boolean | onTrackballEvent(MotionEventevent) Implement this method to handle trackball motion events. | ||||||||||
void | onWindowFocusChanged(boolean hasWindowFocus) Called when the window containing this view gains or loses focus. | ||||||||||
boolean | performClick() Call this view's OnClickListener, if it is defined. | ||||||||||
boolean | performHapticFeedback(int feedbackConstant, int flags) BZZZTT!!1! Like | ||||||||||
boolean | performHapticFeedback(int feedbackConstant) BZZZTT!!1! Provide haptic feedback to the user for this view. | ||||||||||
boolean | performLongClick() Call this view's OnLongClickListener, if it is defined. | ||||||||||
void | playSoundEffect(int soundConstant) Play a sound effect for this view. | ||||||||||
boolean | post(Runnableaction) Causes the Runnable to be added to the message queue. | ||||||||||
boolean | postDelayed(Runnableaction, long delayMillis) Causes the Runnable to be added to the message queue, to be run after the specified amount of time elapses. | ||||||||||
void | postInvalidate(int left, int top, int right, int bottom) Cause an invalidate of the specified area to happen on a subsequent cycle through the event loop. | ||||||||||
void | postInvalidate() Cause an invalidate to happen on a subsequent cycle through the event loop. | ||||||||||
void | postInvalidateDelayed(long delayMilliseconds, int left, int top, int right, int bottom) Cause an invalidate of the specified area to happen on a subsequent cycle through the event loop. | ||||||||||
void | postInvalidateDelayed(long delayMilliseconds) Cause an invalidate to happen on a subsequent cycle through the event loop. | ||||||||||
void | refreshDrawableState() Call this to force a view to update its drawable state. | ||||||||||
boolean | removeCallbacks(Runnableaction) Removes the specified Runnable from the message queue. | ||||||||||
void | removeOnAttachStateChangeListener(View.OnAttachStateChangeListenerlistener) Remove a listener for attach state changes. | ||||||||||
void | removeOnLayoutChangeListener(View.OnLayoutChangeListenerlistener) Remove a listener for layout changes. | ||||||||||
boolean | requestFocus(int direction,RectpreviouslyFocusedRect) Call this to try to give focus to a specific view or to one of its descendants and give it hints about the direction and a specific rectangle that the focus is coming from. | ||||||||||
final boolean | requestFocus(int direction) Call this to try to give focus to a specific view or to one of its descendants and give it a hint about what direction focus is heading. | ||||||||||
final boolean | requestFocus() Call this to try to give focus to a specific view or to one of its descendants. | ||||||||||
final boolean | requestFocusFromTouch() Call this to try to give focus to a specific view or to one of its descendants. | ||||||||||
void | requestLayout() Call this when something has changed which has invalidated the layout of this view. | ||||||||||
boolean | requestRectangleOnScreen(Rectrectangle) Request that a rectangle of this view be visible on the screen, scrolling if necessary just enough. | ||||||||||
boolean | requestRectangleOnScreen(Rectrectangle, boolean immediate) Request that a rectangle of this view be visible on the screen, scrolling if necessary just enough. | ||||||||||
static int | resolveSize(int size, int measureSpec) Version of resolveSizeAndState(int, int, int) returning only the MEASURED_SIZE_MASK bits of the result. | ||||||||||
static int | resolveSizeAndState(int size, int measureSpec, int childMeasuredState) Utility to reconcile a desired size and state, with constraints imposed by a MeasureSpec. | ||||||||||
void | )">restoreHierarchyState(SparseArray<Parcelable> container) Restore this view hierarchy's frozen state from the given container. | ||||||||||
void | )">saveHierarchyState(SparseArray<Parcelable> container) Store this view hierarchy's frozen state into the given container. | ||||||||||
void | scheduleDrawable(Drawablewho,Runnablewhat, long when) Schedules an action on a drawable to occur at a specified time. | ||||||||||
void | scrollBy(int x, int y) Move the scrolled position of your view. | ||||||||||
void | scrollTo(int x, int y) Set the scrolled position of your view. | ||||||||||
void | sendAccessibilityEvent(int eventType) Sends an accessibility event of the given type. | ||||||||||
void | sendAccessibilityEventUnchecked(AccessibilityEventevent) This method behaves exactly as sendAccessibilityEvent(int) but takes as an argument an empty AccessibilityEvent and does not perform a check whether accessibility is enabled. | ||||||||||
void | setAccessibilityDelegate(View.AccessibilityDelegatedelegate) Sets a delegate for implementing accessibility support via compositon as opposed to inheritance. | ||||||||||
void | setActivated(boolean activated) Changes the activated state of this view. | ||||||||||
void | setAlpha(float alpha) Sets the opacity of the view. | ||||||||||
void | setAnimation(Animationanimation) Sets the next animation to play for this view. | ||||||||||
void | setBackgroundColor(int color) Sets the background color for this view. | ||||||||||
void | setBackgroundDrawable(Drawabled) Set the background to a given Drawable, or remove the background. | ||||||||||
void | setBackgroundResource(int resid) Set the background to a given resource. | ||||||||||
final void | setBottom(int bottom) Sets the bottom position of this view relative to its parent. | ||||||||||
void | setCameraDistance(float distance) Sets the distance along the Z axis (orthogonal to the X/Y plane on which views are drawn) from the camera to this view. | ||||||||||
void | setClickable(boolean clickable) Enables or disables click events for this view. | ||||||||||
void | setContentDescription(CharSequencecontentDescription) Sets the View description. | ||||||||||
void | setDrawingCacheBackgroundColor(int color) Setting a solid background color for the drawing cache's bitmaps will improve performance and memory usage. | ||||||||||
void | setDrawingCacheEnabled(boolean enabled) Enables or disables the drawing cache. | ||||||||||
void | setDrawingCacheQuality(int quality) Set the drawing cache quality of this view. | ||||||||||
void | setDuplicateParentStateEnabled(boolean enabled) Enables or disables the duplication of the parent's state into this view. | ||||||||||
void | setEnabled(boolean enabled) Set the enabled state of this view. | ||||||||||
void | setFadingEdgeLength(int length) Set the size of the faded edge used to indicate that more content in this view is available. | ||||||||||
void | setFilterTouchesWhenObscured(boolean enabled) Sets whether the framework should discard touches when the view's window is obscured by another visible window. | ||||||||||
void | setFitsSystemWindows(boolean fitSystemWindows) Set whether or not this view should account for system screen decorations such as the status bar and inset its content. | ||||||||||
void | setFocusable(boolean focusable) Set whether this view can receive the focus. | ||||||||||
void | setFocusableInTouchMode(boolean focusableInTouchMode) Set whether this view can receive focus while in touch mode. | ||||||||||
void | setHapticFeedbackEnabled(boolean hapticFeedbackEnabled) Set whether this view should have haptic feedback for events such as long presses. | ||||||||||
void | setHorizontalFadingEdgeEnabled(boolean horizontalFadingEdgeEnabled) Define whether the horizontal edges should be faded when this view is scrolled horizontally. | ||||||||||
void | setHorizontalScrollBarEnabled(boolean horizontalScrollBarEnabled) Define whether the horizontal scrollbar should be drawn or not. | ||||||||||
void | setHovered(boolean hovered) Sets whether the view is currently hovered. | ||||||||||
void | setId(int id) Sets the identifier for this view. | ||||||||||
void | setKeepScreenOn(boolean keepScreenOn) Controls whether the screen should remain on, modifying the value of KEEP_SCREEN_ON . | ||||||||||
void | setLayerType(int layerType,Paintpaint) Specifies the type of layer backing this view. | ||||||||||
void | setLayoutParams(ViewGroup.LayoutParamsparams) Set the layout parameters associated with this view. | ||||||||||
final void | setLeft(int left) Sets the left position of this view relative to its parent. | ||||||||||
void | setLongClickable(boolean longClickable) Enables or disables long click events for this view. | ||||||||||
void | setMinimumHeight(int minHeight) Sets the minimum height of the view. | ||||||||||
void | setMinimumWidth(int minWidth) Sets the minimum width of the view. | ||||||||||
void | setNextFocusDownId(int nextFocusDownId) Sets the id of the view to use when the next focus is FOCUS_DOWN . | ||||||||||
void | setNextFocusForwardId(int nextFocusForwardId) Sets the id of the view to use when the next focus is FOCUS_FORWARD . | ||||||||||
void | setNextFocusLeftId(int nextFocusLeftId) Sets the id of the view to use when the next focus is FOCUS_LEFT . | ||||||||||
void | setNextFocusRightId(int nextFocusRightId) Sets the id of the view to use when the next focus is FOCUS_RIGHT . | ||||||||||
void | setNextFocusUpId(int nextFocusUpId) Sets the id of the view to use when the next focus is FOCUS_UP . | ||||||||||
void | setOnClickListener(View.OnClickListenerl) Register a callback to be invoked when this view is clicked. | ||||||||||
void | setOnCreateContextMenuListener(View.OnCreateContextMenuListenerl) Register a callback to be invoked when the context menu for this view is being built. | ||||||||||
void | setOnDragListener(View.OnDragListenerl) Register a drag event listener callback object for this View. | ||||||||||
void | setOnFocusChangeListener(View.OnFocusChangeListenerl) Register a callback to be invoked when focus of this view changed. | ||||||||||
void | setOnGenericMotionListener(View.OnGenericMotionListenerl) Register a callback to be invoked when a generic motion event is sent to this view. | ||||||||||
void | setOnHoverListener(View.OnHoverListenerl) Register a callback to be invoked when a hover event is sent to this view. | ||||||||||
void | setOnKeyListener(View.OnKeyListenerl) Register a callback to be invoked when a key is pressed in this view. | ||||||||||
void | setOnLongClickListener(View.OnLongClickListenerl) Register a callback to be invoked when this view is clicked and held. | ||||||||||
void | setOnSystemUiVisibilityChangeListener(View.OnSystemUiVisibilityChangeListenerl) Set a listener to receive callbacks when the visibility of the system bar changes. | ||||||||||
void | setOnTouchListener(View.OnTouchListenerl) Register a callback to be invoked when a touch event is sent to this view. | ||||||||||
void | setOverScrollMode(int overScrollMode) Set the over-scroll mode for this view. | ||||||||||
void | setPadding(int left, int top, int right, int bottom) Sets the padding. | ||||||||||
void | setPivotX(float pivotX) Sets the x location of the point around which the view is rotated and scaled . | ||||||||||
void | setPivotY(float pivotY) Sets the y location of the point around which the view is rotated and scaled . | ||||||||||
void | setPressed(boolean pressed) Sets the pressed state for this view. | ||||||||||
final void | setRight(int right) Sets the right position of this view relative to its parent. | ||||||||||
void | setRotation(float rotation) Sets the degrees that the view is rotated around the pivot point. | ||||||||||
void | setRotationX(float rotationX) Sets the degrees that the view is rotated around the horizontal axis through the pivot point. | ||||||||||
void | setRotationY(float rotationY) Sets the degrees that the view is rotated around the vertical axis through the pivot point. | ||||||||||
void | setSaveEnabled(boolean enabled) Controls whether the saving of this view's state is enabled (that is, whether its onSaveInstanceState() method will be called). | ||||||||||
void | setSaveFromParentEnabled(boolean enabled) Controls whether the entire hierarchy under this view will save its state when a state saving traversal occurs from its parent. | ||||||||||
void | setScaleX(float scaleX) Sets the amount that the view is scaled in x around the pivot point, as a proportion of the view's unscaled width. | ||||||||||
void | setScaleY(float scaleY) Sets the amount that the view is scaled in Y around the pivot point, as a proportion of the view's unscaled width. | ||||||||||
void | setScrollBarStyle(int style) Specify the style of the scrollbars. | ||||||||||
void | setScrollContainer(boolean isScrollContainer) Change whether this view is one of the set of scrollable containers in its window. | ||||||||||
void | setScrollX(int value) Set the horizontal scrolled position of your view. | ||||||||||
void | setScrollY(int value) Set the vertical scrolled position of your view. | ||||||||||
void | setScrollbarFadingEnabled(boolean fadeScrollbars) Define whether scrollbars will fade when the view is not scrolling. | ||||||||||
void | setSelected(boolean selected) Changes the selection state of this view. | ||||||||||
void | setSoundEffectsEnabled(boolean soundEffectsEnabled) Set whether this view should have sound effects enabled for events such as clicking and touching. | ||||||||||
void | setSystemUiVisibility(int visibility) Request that the visibility of the status bar be changed. | ||||||||||
void | setTag(int key,Objecttag) Sets a tag associated with this view and a key. | ||||||||||
void | setTag(Objecttag) Sets the tag associated with this view. | ||||||||||
final void | setTop(int top) Sets the top position of this view relative to its parent. | ||||||||||
void | setTouchDelegate(TouchDelegatedelegate) Sets the TouchDelegate for this View. | ||||||||||
void | setTranslationX(float translationX) Sets the horizontal location of this view relative to its left position. | ||||||||||
void | setTranslationY(float translationY) Sets the vertical location of this view relative to its top position. | ||||||||||
void | setVerticalFadingEdgeEnabled(boolean verticalFadingEdgeEnabled) Define whether the vertical edges should be faded when this view is scrolled vertically. | ||||||||||
void | setVerticalScrollBarEnabled(boolean verticalScrollBarEnabled) Define whether the vertical scrollbar should be drawn or not. | ||||||||||
void | setVerticalScrollbarPosition(int position) Set the position of the vertical scroll bar. | ||||||||||
void | setVisibility(int visibility) Set the enabled state of this view. | ||||||||||
void | setWillNotCacheDrawing(boolean willNotCacheDrawing) When a View's drawing cache is enabled, drawing is redirected to an offscreen bitmap. | ||||||||||
void | setWillNotDraw(boolean willNotDraw) If this view doesn't do any drawing on its own, set this flag to allow further optimizations. | ||||||||||
void | setX(float x) Sets the visual x position of this view, in pixels. | ||||||||||
void | setY(float y) Sets the visual y position of this view, in pixels. | ||||||||||
boolean | showContextMenu() Bring up the context menu for this view. | ||||||||||
ActionMode | startActionMode(ActionMode.Callbackcallback) Start an action mode. | ||||||||||
void | startAnimation(Animationanimation) Start the specified animation now. | ||||||||||
final boolean | startDrag(ClipDatadata,View.DragShadowBuildershadowBuilder,ObjectmyLocalState, int flags) Starts a drag and drop operation. | ||||||||||
void | unscheduleDrawable(Drawablewho) Unschedule any events associated with the given Drawable. | ||||||||||
void | unscheduleDrawable(Drawablewho,Runnablewhat) Cancels a scheduled action on a drawable. | ||||||||||
boolean | willNotCacheDrawing() Returns whether or not this View can cache its drawing or not. | ||||||||||
boolean | willNotDraw() Returns whether or not this View draws on its own. |
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
boolean | awakenScrollBars(int startDelay) Trigger the scrollbars to draw. | ||||||||||
boolean | awakenScrollBars(int startDelay, boolean invalidate) Trigger the scrollbars to draw. | ||||||||||
boolean | awakenScrollBars() Trigger the scrollbars to draw. | ||||||||||
int | computeHorizontalScrollExtent() Compute the horizontal extent of the horizontal scrollbar's thumb within the horizontal range. | ||||||||||
int | computeHorizontalScrollOffset() Compute the horizontal offset of the horizontal scrollbar's thumb within the horizontal range. | ||||||||||
int | computeHorizontalScrollRange() Compute the horizontal range that the horizontal scrollbar represents. | ||||||||||
int | computeVerticalScrollExtent() Compute the vertical extent of the horizontal scrollbar's thumb within the vertical range. | ||||||||||
int | computeVerticalScrollOffset() Compute the vertical offset of the vertical scrollbar's thumb within the horizontal range. | ||||||||||
int | computeVerticalScrollRange() Compute the vertical range that the vertical scrollbar represents. | ||||||||||
void | dispatchDraw(Canvascanvas) Called by draw to draw the child views. | ||||||||||
boolean | dispatchGenericFocusedEvent(MotionEventevent) Dispatch a generic motion event to the currently focused view. | ||||||||||
boolean | dispatchGenericPointerEvent(MotionEventevent) Dispatch a generic motion event to the view under the first pointer. | ||||||||||
boolean | dispatchHoverEvent(MotionEventevent) Dispatch a hover event. | ||||||||||
void | )">dispatchRestoreInstanceState(SparseArray<Parcelable> container) Called by )">restoreHierarchyState(android.util.SparseArray) to retrieve the state for this view and its children. | ||||||||||
void | )">dispatchSaveInstanceState(SparseArray<Parcelable> container) Called by )">saveHierarchyState(android.util.SparseArray) to store the state for this view and its children. | ||||||||||
void | dispatchSetActivated(boolean activated) Dispatch setActivated to all of this View's children. | ||||||||||
void | dispatchSetPressed(boolean pressed) Dispatch setPressed to all of this View's children. | ||||||||||
void | dispatchSetSelected(boolean selected) Dispatch setSelected to all of this View's children. | ||||||||||
void | dispatchVisibilityChanged(ViewchangedView, int visibility) Dispatch a view visibility change down the view hierarchy. | ||||||||||
void | drawableStateChanged() This function is called whenever the state of the view changes in such a way that it impacts the state of drawables being shown. | ||||||||||
boolean | fitSystemWindows(Rectinsets) Apply the insets for system windows to this view, if the FITS_SYSTEM_WINDOWS flag is set | ||||||||||
float | getBottomFadingEdgeStrength() Returns the strength, or intensity, of the bottom faded edge. | ||||||||||
int | getBottomPaddingOffset() Amount by which to extend the bottom fading region. | ||||||||||
ContextMenu.ContextMenuInfo | getContextMenuInfo() Views should implement this if they have extra information to associate with the context menu. | ||||||||||
int | getHorizontalScrollbarHeight() Returns the height of the horizontal scrollbar. | ||||||||||
float | getLeftFadingEdgeStrength() Returns the strength, or intensity, of the left faded edge. | ||||||||||
int | getLeftPaddingOffset() Amount by which to extend the left fading region. | ||||||||||
float | getRightFadingEdgeStrength() Returns the strength, or intensity, of the right faded edge. | ||||||||||
int | getRightPaddingOffset() Amount by which to extend the right fading region. | ||||||||||
int | getSuggestedMinimumHeight() Returns the suggested minimum height that the view should use. | ||||||||||
int | getSuggestedMinimumWidth() Returns the suggested minimum width that the view should use. | ||||||||||
float | getTopFadingEdgeStrength() Returns the strength, or intensity, of the top faded edge. | ||||||||||
int | getTopPaddingOffset() Amount by which to extend the top fading region. | ||||||||||
int | getWindowAttachCount() | ||||||||||
void | initializeFadingEdge(TypedArraya) Initializes the fading edges from a given set of styled attributes. | ||||||||||
void | initializeScrollbars(TypedArraya) Initializes the scrollbars from a given set of styled attributes. | ||||||||||
boolean | isPaddingOffsetRequired() If the View draws content inside its padding and enables fading edges, it needs to support padding offsets. | ||||||||||
static int[] | mergeDrawableStates(int[] baseState, int[] additionalState) Merge your own state values in additionalState into the base state values baseState that were returned by onCreateDrawableState(int) . | ||||||||||
void | onAnimationEnd() Invoked by a parent ViewGroup to notify the end of the animation currently associated with this view. | ||||||||||
void | onAnimationStart() Invoked by a parent ViewGroup to notify the start of the animation currently associated with this view. | ||||||||||
void | onAttachedToWindow() This is called when the view is attached to a window. | ||||||||||
void | onConfigurationChanged(ConfigurationnewConfig) Called when the current configuration of the resources being used by the application have changed. | ||||||||||
void | onCreateContextMenu(ContextMenumenu) Views should implement this if the view itself is going to add items to the context menu. | ||||||||||
int[] | onCreateDrawableState(int extraSpace) Generate the new Drawable state for this view. | ||||||||||
void | onDetachedFromWindow() This is called when the view is detached from a window. | ||||||||||
void | onDisplayHint(int hint) Gives this view a hint about whether is displayed or not. | ||||||||||
void | onDraw(Canvascanvas) Implement this to do your drawing. | ||||||||||
final void | onDrawScrollBars(Canvascanvas) Request the drawing of the horizontal and the vertical scrollbar. | ||||||||||
void | onFinishInflate() Finalize inflating a view from XML. | ||||||||||
void | onFocusChanged(boolean gainFocus, int direction,RectpreviouslyFocusedRect) Called by the view system when the focus state of this view changes. | ||||||||||
void | onLayout(boolean changed, int left, int top, int right, int bottom) Called from layout when this view should assign a size and position to each of its children. | ||||||||||
void | onMeasure(int widthMeasureSpec, int heightMeasureSpec) Measure the view and its content to determine the measured width and the measured height. | ||||||||||
void | onOverScrolled(int scrollX, int scrollY, boolean clampedX, boolean clampedY) Called by overScrollBy(int, int, int, int, int, int, int, int, boolean) to respond to the results of an over-scroll operation. | ||||||||||
void | onRestoreInstanceState(Parcelablestate) Hook allowing a view to re-apply a representation of its internal state that had previously been generated by onSaveInstanceState() . | ||||||||||
Parcelable | onSaveInstanceState() Hook allowing a view to generate a representation of its internal state that can later be used to create a new instance with that same state. | ||||||||||
void | onScrollChanged(int l, int t, int oldl, int oldt) This is called in response to an internal scroll in this view (i.e., the view scrolled its own contents). | ||||||||||
boolean | onSetAlpha(int alpha) Invoked if there is a Transform that involves alpha. | ||||||||||
void | onSizeChanged(int w, int h, int oldw, int oldh) This is called during layout when the size of this view has changed. | ||||||||||
void | onVisibilityChanged(ViewchangedView, int visibility) Called when the visibility of the view or an ancestor of the view is changed. | ||||||||||
void | onWindowVisibilityChanged(int visibility) Called when the window containing has change its visibility (between GONE , INVISIBLE , and VISIBLE ). | ||||||||||
boolean | overScrollBy(int deltaX, int deltaY, int scrollX, int scrollY, int scrollRangeX, int scrollRangeY, int maxOverScrollX, int maxOverScrollY, boolean isTouchEvent) Scroll the view with standard behavior for scrolling beyond the normal content boundaries. | ||||||||||
final void | setMeasuredDimension(int measuredWidth, int measuredHeight) This mehod must be called by | ||||||||||
boolean | verifyDrawable(Drawablewho) If your view subclass is displaying its own Drawable objects, it should override this function and return true for any Drawable it is displaying. |
[Expand] Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From classjava.lang.Object | |||||||||||
From interfaceandroid.graphics.drawable.Drawable.Callback | |||||||||||
From interfaceandroid.view.KeyEvent.Callback | |||||||||||
From interfaceandroid.view.accessibility.AccessibilityEventSource |
更多相关文章
- android开发:View中android:fadingEdge属性的作用
- 0324安卓如何设置标题栏颜色
- 记录状态栏与布局重合,状态栏颜色问题
- Android获取Theme的背景颜色
- android属性android:largeHeap