java.lang.Object | ||||
android.view.View | Drawable.Callback KeyEvent.Callback | |||
android.widget.ImageView | ||||
android.widget.ImageButton |
An image button displays an image that can be pressed, or clicked, by the user.
XML attributes
See Button Attributes, View Attributes
Attribute name | Related methods | |
---|---|---|
android:adjustViewBounds | setAdjustViewBounds(boolean) |
Set this to true if you want the ImageView to adjust its bounds to preserve the aspect ratio of its drawable. |
android:maxHeight | setMaxHeight(int) |
An optional argument to supply a maximum height for this view. |
android:maxWidth | setMaxWidth(int) |
An optional argument to supply a maximum width for this view. |
android:scaleType | setScaleType(ImageView.ScaleType) |
Controls how the image should be resized or moved to match the size of this ImageView. |
android:src | setImageResource(int) |
Sets a drawable as the content of this ImageView. |
android:tint | setColorFilter(int,PorterDuff.Mode) |
Set a tinting color for the image
Must be a color value, in the form of " |
Attribute name | Related methods | |
---|---|---|
android:background | setBackgroundResource(int) |
A drawable to use as the background. |
android:clickable | setClickable(boolean) |
Defines whether this view reacts to click events. |
android:drawingCacheQuality | setDrawingCacheQuality(int) |
Defines the quality of translucent drawing caches. |
android:fadingEdge | setVerticalFadingEdgeEnabled(boolean) |
Defines which edges should be fadeded on scrolling. |
android:fadingEdgeLength | getVerticalFadingEdgeLength() |
Defines the length of the fading edges. |
android:fitsSystemWindows | 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:id | setId(int) |
Supply an identifier name for this view, to later retrieve it with View.findViewById() or Activity.findViewById(). |
android:keepScreenOn | setKeepScreenOn(boolean) |
Controls whether the view's window should keep the screen on while visible. |
android:longClickable | setLongClickable(boolean) |
Defines whether this view reacts to long click events. |
android:nextFocusDown | setNextFocusDownId(int) |
Defines the next view to give focus to when the next focus is FOCUS_DOWN If the reference refers to a view that does not exist or is part of a hierarchy that is invisible, a RuntimeException will result when the reference is accessed. |
android:nextFocusLeft | setNextFocusLeftId(int) |
Defines the next view to give focus to when the next focus is FOCUS_LEFT. |
android:nextFocusRight | setNextFocusRightId(int) |
Defines the next view to give focus to when the next focus is FOCUS_RIGHT If the reference refers to a view that does not exist or is part of a hierarchy that is invisible, a RuntimeException will result when the reference is accessed. |
android:nextFocusUp | setNextFocusUpId(int) |
Defines the next view to give focus to when the next focus is FOCUS_UP If the reference refers to a view that does not exist or is part of a hierarchy that is invisible, a RuntimeException will result when the reference is accessed. |
android: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; see padding. |
android:paddingLeft | setPadding(int,int,int,int) |
Sets the padding, in pixels, of the left edge; see padding. |
android:paddingRight | setPadding(int,int,int,int) |
Sets the padding, in pixels, of the right edge; see padding. |
android:paddingTop | setPadding(int,int,int,int) |
Sets the padding, in pixels, of the top edge; see padding. |
android:saveEnabled | setSaveEnabled(boolean) |
If unset, no state will be saved for this view when it is being frozen. |
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
Must be a boolean value, either " |
|
android:scrollbarSize | Sets the width of vertical scrollbars and height of horizontal scrollbars. | |
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:visibility | setVisibility(int) |
Controls the initial visibility of the view. |
Value | ||||
---|---|---|---|---|
int | DRAWING_CACHE_QUALITY_AUTO | Enables automatic quality mode for the drawing cache. |
0 | 0x00000000 |
int | DRAWING_CACHE_QUALITY_HIGH | Enables high quality mode for the drawing cache. |
1048576 | 0x00100000 |
int | DRAWING_CACHE_QUALITY_LOW | Enables low quality mode for the drawing cache. |
524288 | 0x00080000 |
int[] | EMPTY_STATE_SET | Indicates the view has no states set. | ||
int[] | ENABLED_FOCUSED_SELECTED_STATE_SET | Indicates the view is enabled, focused and selected. | ||
int[] | ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET | Indicates the view is enabled, focused, selected and its window has the focus. | ||
int[] | ENABLED_FOCUSED_STATE_SET | Indicates the view is enabled and has the focus. | ||
int[] | ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET | Indicates the view is enabled, focused and its window has the focus. | ||
int[] | ENABLED_SELECTED_STATE_SET | Indicates the view is enabled and selected. | ||
int[] | ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET | Indicates the view is enabled, selected and its window has the focus. | ||
int[] | ENABLED_STATE_SET | Indicates the view is enabled. | ||
int[] | ENABLED_WINDOW_FOCUSED_STATE_SET | Indicates the view is enabled and that its window has focus. | ||
int[] | FOCUSED_SELECTED_STATE_SET | Indicates the view is focused and selected. | ||
int[] | FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET | Indicates the view is focused, selected and its window has the focus. | ||
int[] | FOCUSED_STATE_SET | Indicates the view is focused. | ||
int[] | FOCUSED_WINDOW_FOCUSED_STATE_SET | Indicates the view has the focus and that its window has the focus. | ||
int | FOCUS_BACKWARD | Use with focusSearch(int). | 1 | 0x00000001 |
int | FOCUS_DOWN | Use with focusSearch(int). | 130 | 0x00000082 |
int | FOCUS_FORWARD | Use with focusSearch(int). | 2 | 0x00000002 |
int | FOCUS_LEFT | Use with focusSearch(int). | 17 | 0x00000011 |
int | FOCUS_RIGHT | Use with focusSearch(int). | 66 | 0x00000042 |
int | FOCUS_UP | Use with focusSearch(int). | 33 | 0x00000021 |
int | GONE | This view is invisible, and it doesn't take any space for layout purposes. | 8 | 0x00000008 |
int | INVISIBLE | This view is invisible, but it still takes up space for layout purposes. | 4 | 0x00000004 |
int | KEEP_SCREEN_ON | View flag indicating that the screen should remain on while the window containing this view is visible to the user. | 67108864 | 0x04000000 |
int | NO_ID | Used to mark a View that has no ID. | -1 | 0xffffffff |
int[] | PRESSED_ENABLED_FOCUSED_SELECTED_STATE_SET | Indicates the view is pressed, enabled, focused and selected. | ||
int[] | PRESSED_ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET | Indicates the view is pressed, enabled, focused, selected and its window has the focus. | ||
int[] | PRESSED_ENABLED_FOCUSED_STATE_SET | Indicates the view is pressed, enabled and focused. | ||
int[] | PRESSED_ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET | Indicates the view is pressed, enabled, focused and its window has the focus. | ||
int[] | PRESSED_ENABLED_SELECTED_STATE_SET | Indicates the view is pressed, enabled and selected. | ||
int[] | PRESSED_ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET | Indicates the view is pressed, enabled, selected and its window has the focus. | ||
int[] | PRESSED_ENABLED_STATE_SET | Indicates the view is pressed and enabled. | ||
int[] | PRESSED_ENABLED_WINDOW_FOCUSED_STATE_SET | Indicates the view is pressed, enabled and its window has the focus. | ||
int[] | PRESSED_FOCUSED_SELECTED_STATE_SET | Indicates the view is pressed, focused and selected. | ||
int[] | PRESSED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET | Indicates the view is pressed, focused, selected and its window has the focus. | ||
int[] | PRESSED_FOCUSED_STATE_SET | Indicates the view is pressed and focused. | ||
int[] | PRESSED_FOCUSED_WINDOW_FOCUSED_STATE_SET | Indicates the view is pressed, focused and its window has the focus. | ||
int[] | PRESSED_SELECTED_STATE_SET | Indicates the view is pressed and selected. | ||
int[] | PRESSED_SELECTED_WINDOW_FOCUSED_STATE_SET | Indicates the view is pressed, selected and its window has the focus. | ||
int[] | PRESSED_WINDOW_FOCUSED_STATE_SET | Indicates the view is pressed and its window has the focus. | ||
int | SCROLLBARS_INSIDE_INSET | The scrollbar style to display the scrollbars inside the padded area, increasing the padding of the view. | 16777216 | 0x01000000 |
int | SCROLLBARS_INSIDE_OVERLAY | The scrollbar style to display the scrollbars inside the content area, without increasing the padding. | 0 | 0x00000000 |
int | SCROLLBARS_OUTSIDE_INSET | The scrollbar style to display the scrollbars at the edge of the view, increasing the padding of the view. | 50331648 | 0x03000000 |
int | SCROLLBARS_OUTSIDE_OVERLAY | The scrollbar style to display the scrollbars at the edge of the view, without increasing the padding. | 33554432 | 0x02000000 |
int[] | SELECTED_STATE_SET | Indicates the view is selected. | ||
int[] | SELECTED_WINDOW_FOCUSED_STATE_SET | Indicates the view is selected and that its window has the focus. | ||
String | VIEW_LOG_TAG | The logging tag used by this class with android.util.Log. | "View" | |
int | VISIBLE | This view is visible. | 0 | 0x00000000 |
int[] | WINDOW_FOCUSED_STATE_SET | Indicates the view's window has focus. |
protected | int | mBottom | The distance in pixels from the top edge of this view's parent to the bottom edge of this view. | ||
protected | Context | mContext | The application environment this view lives in. | ||
protected | ViewGroup.LayoutParams | mLayoutParams | The layout parameters associated with this view and used by the parent ViewGroup to determine how this view should be laid out. | ||
protected | int | mLeft | The distance in pixels from the left edge of this view's parent to the left edge of this view. | ||
protected | final | int[] | mLocation | Used to store a pair of coordinates, for instance returned values returned by getLocationInWindow(int[]). | |
protected | View.OnClickListener | mOnClickListener | Listener used to dispatch click events. | ||
protected | View.OnCreateContextMenuListener | mOnCreateContextMenuListener | Listener used to build the context menu. | ||
protected | View.OnFocusChangeListener | mOnFocusChangeListener | Listener used to dispatch focus change events. | ||
protected | View.OnLongClickListener | mOnLongClickListener | Listener used to dispatch long click events. | ||
protected | int | mPaddingBottom | 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. | ||
protected | int | mPaddingLeft | 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. | ||
protected | int | mPaddingRight | 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. | ||
protected | int | mPaddingTop | 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. | ||
protected | ViewParent | mParent | The parent this view is attached to. | ||
protected | int | mRight | The distance in pixels from the left edge of this view's parent to the right edge of this view. | ||
protected | int | mScrollX | The offset, in pixels, by which the content of this view is scrolled horizontally. | ||
protected | int | mScrollY | The offset, in pixels, by which the content of this view is scrolled vertically. | ||
protected | Object | mTag | The view's tag. | ||
protected | int | mTop | The distance in pixels from the top edge of this view's parent to the top edge of this view. | ||
protected | int | mUserPaddingBottom | Cache the paddingBottom set by the user to append to the scrollbar's size. | ||
protected | int | mUserPaddingRight | Cache the paddingRight set by the user to append to the scrollbar's size. |
ImageButton(Context context) | ||||||
ImageButton(Context context, AttributeSet attrs) | ||||||
ImageButton(Context context, AttributeSet attrs, int defStyle) |
boolean | onSetAlpha(int alpha) | |||||
Invoked if there is a Transform that involves alpha. |
final | void | clearColorFilter() | ||||
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. | ||||||
int | getBaseline() | |||||
Return the offset of the widget's text baseline from the widget's top boundary. |
||||||
Drawable | getDrawable() | |||||
Return the view's drawable, or null if no drawable has been assigned. | ||||||
Matrix | getImageMatrix() | |||||
Return the view's optional matrix. | ||||||
ImageView.ScaleType | getScaleType() | |||||
Return the current scale type in use by this ImageView. | ||||||
void | invalidateDrawable(Drawable dr) | |||||
Invalidates the specified Drawable. | ||||||
int[] | onCreateDrawableState(int extraSpace) | |||||
Generate the new Drawable state for this view. | ||||||
void | onDraw(Canvas canvas) | |||||
Implement this to do your drawing. | ||||||
void | onMeasure(int widthMeasureSpec, int heightMeasureSpec) | |||||
Measure the view and its content to determine the measured width and the measured height. |
||||||
boolean | onSetAlpha(int alpha) | |||||
Invoked if there is a Transform that involves alpha. | ||||||
void | setAdjustViewBounds(boolean adjustViewBounds) | |||||
Set this to true if you want the ImageView to adjust its bounds to preserve the aspect ratio of its drawable. | ||||||
void | setAlpha(int alpha) | |||||
void | setColorFilter(ColorFilter cf) | |||||
Apply an arbitrary colorfilter to the image. | ||||||
final | void | setColorFilter(int color, PorterDuff.Mode mode) | ||||
Set a tinting option for the image. | ||||||
boolean | setFrame(int l, int t, int r, int b) | |||||
Assign a size and position to this view. | ||||||
void | setImageBitmap(Bitmap bm) | |||||
Sets a Bitmap as the content of this ImageView. | ||||||
void | setImageDrawable(Drawable drawable) | |||||
Sets a drawable as the content of this ImageView. | ||||||
void | setImageLevel(int level) | |||||
void | setImageMatrix(Matrix matrix) | |||||
void | setImageResource(int resId) | |||||
Sets a drawable as the content of this ImageView. | ||||||
void | setImageState(int[] state, boolean merge) | |||||
void | setImageURI(Uri uri) | |||||
Sets the content of this ImageView to the specified Uri. | ||||||
void | setMaxHeight(int maxHeight) | |||||
An optional argument to supply a maximum height for this view. | ||||||
void | setMaxWidth(int maxWidth) | |||||
An optional argument to supply a maximum width for this view. | ||||||
void | setScaleType(ImageView.ScaleType scaleType) | |||||
Controls how the image should be resized or moved to match the size of this ImageView. | ||||||
void | setSelected(boolean selected) | |||||
Changes the selection state of this view. | ||||||
boolean | verifyDrawable(Drawable dr) | |||||
If your view subclass is displaying its own Drawable objects, it should override this function and return true for any Drawable it is displaying. |
void | 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 | 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. | ||||||
void | bringToFront() | |||||
Change the view's z order in the tree, so it's on top of other sibling views | ||||||
void | buildDrawingCache() | |||||
Forces the drawing cache to be built if the drawing cache is invalid. |
||||||
void | cancelLongPress() | |||||
Cancels a pending long press. | ||||||
void | clearAnimation() | |||||
Cancels any animations for this view. | ||||||
void | clearFocus() | |||||
Called when this view wants to give up focus. | ||||||
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. |
||||||
void | computeScroll() | |||||
Called by a parent to request that a child update its values for mScrollX and mScrollY if necessary. | ||||||
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 | createContextMenu(ContextMenu menu) | |||||
Show the context menu for this view. | ||||||
void | destroyDrawingCache() | |||||
Frees the resources used by the drawing cache. |
||||||
void | dispatchDraw(Canvas canvas) | |||||
Called by draw to draw the child views. | ||||||
boolean | dispatchKeyEvent(KeyEvent event) | |||||
Dispatch a key event to the next view on the focus path. | ||||||
boolean | dispatchKeyShortcutEvent(KeyEvent event) | |||||
Dispatches a key shortcut event. | ||||||
void | dispatchRestoreInstanceState(SparseArray<Parcelable> container) | |||||
Called by restoreHierarchyState(SparseArray |
||||||
void | dispatchSaveInstanceState(SparseArray<Parcelable> container) | |||||
Called by saveHierarchyState(SparseArray |
||||||
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. | ||||||
boolean | dispatchTouchEvent(MotionEvent event) | |||||
Pass the touch screen motion event down to the target view, or this view if it is the target. | ||||||
boolean | dispatchTrackballEvent(MotionEvent event) | |||||
Pass a trackball motion event down to the focused view. | ||||||
boolean | dispatchUnhandledMove(View focused, 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(Canvas canvas) | |||||
Manually render this view (and all of its children) to the given Canvas. | ||||||
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. | ||||||
void | finalize() | |||||
Called by the virtual machine when there are no longer any (non-weak) references to the receiver. | ||||||
View | findFocus() | |||||
Find the view in the hierarchy rooted at this view that currently has focus. | ||||||
final | View | findViewById(int id) | ||||
Look for a child view with the given id. | ||||||
final | View | findViewWithTag(Object tag) | ||||
Look for a child view with the given tag. | ||||||
boolean | fitSystemWindows(Rect insets) | |||||
Apply the insets for system windows to this view, if the FITS_SYSTEM_WINDOWS flag is set | ||||||
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. | ||||||
Animation | getAnimation() | |||||
Get the animation currently associated with this view. | ||||||
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. | ||||||
float | getBottomFadingEdgeStrength() | |||||
Returns the strength, or intensity, of the bottom faded edge. | ||||||
final | Context | getContext() | ||||
Returns the context the view is running in, through which it can access the current theme, resources, etc. | ||||||
ContextMenu.ContextMenuInfo | getContextMenuInfo() | |||||
Views should implement this if they have extra information to associate with the context menu. | ||||||
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() | |||||
Returns the bitmap in which this view drawing is cached. |
||||||
int | getDrawingCacheBackgroundColor() | |||||
int | getDrawingCacheQuality() | |||||
Returns the quality of the drawing cache. | ||||||
void | getDrawingRect(Rect outRect) | |||||
Return the visible drawing bounds of your view. | ||||||
long | getDrawingTime() | |||||
Return the time at which the drawing of the view hierarchy started. |
||||||
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(Rect r) | |||||
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(Rect r, Point globalOffset) | |||||
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(Rect r) | ||||
Handler | getHandler() | |||||
final | int | getHeight() | ||||
Return the height of your view. | ||||||
void | getHitRect(Rect outRect) | |||||
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 | getHorizontalScrollbarHeight() | |||||
Returns the height of the horizontal scrollbar. | ||||||
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. | ||||||
ViewGroup.LayoutParams | getLayoutParams() | |||||
Get the LayoutParams associated with this view. | ||||||
final | int | getLeft() | ||||
Left position of this view relative to its parent. | ||||||
float | getLeftFadingEdgeStrength() | |||||
Returns the strength, or intensity, of the left faded edge. | ||||||
final | boolean | getLocalVisibleRect(Rect r) | ||||
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. |
||||||
final | int | getMeasuredHeight() | ||||
The height of this view as measured in the most recent call to measure(). | ||||||
final | int | getMeasuredWidth() | ||||
The width of this view as measured in the most recent call to measure(). | ||||||
int | getNextFocusDownId() | |||||
int | getNextFocusLeftId() | |||||
int | getNextFocusRightId() | |||||
int | getNextFocusUpId() | |||||
View.OnFocusChangeListener | getOnFocusChangeListener() | |||||
Returns the focus-change callback registered 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. | ||||||
final | ViewParent | getParent() | ||||
Gets the parent of this view. | ||||||
Resources | getResources() | |||||
Returns the resources associated with this view. | ||||||
final | int | getRight() | ||||
Right position of this view relative to its parent. | ||||||
float | getRightFadingEdgeStrength() | |||||
Returns the strength, or intensity, of the right faded edge. | ||||||
View | getRootView() | |||||
Finds the topmost view in the current view hierarchy. |
||||||
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 | getSuggestedMinimumHeight() | |||||
Returns the suggested minimum height that the view should use. | ||||||
int | getSuggestedMinimumWidth() | |||||
Returns the suggested minimum width that the view should use. | ||||||
Object | getTag() | |||||
Returns this view's tag. | ||||||
final | int | getTop() | ||||
Top position of this view relative to its parent. | ||||||
float | getTopFadingEdgeStrength() | |||||
Returns the strength, or intensity, of the top faded edge. | ||||||
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. | ||||||
int | getVerticalFadingEdgeLength() | |||||
Returns the size of the vertical faded edges used to indicate that more content in this view is visible. | ||||||
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. | ||||||
int | getWindowAttachCount() | |||||
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). | ||||||
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 | hasWindowFocus() | |||||
Returns true if this view is in a window that currently has window focus. | ||||||
static | View | inflate(Context context, int resource, ViewGroup root) | ||||
Inflate a view from an XML resource. | ||||||
void | initializeFadingEdge(TypedArray a) | |||||
Initializes the fading edges from a given set of styled attributes. |
||||||
void | initializeScrollbars(TypedArray a) | |||||
Initializes the scrollbars from a given set of styled attributes. |
||||||
void | invalidate(int l, int t, int r, int b) | |||||
Mark the the area defined by the rect (l,t,r,b) as needing to be drawn. | ||||||
void | invalidate() | |||||
Invalidate the whole view. | ||||||
void | invalidate(Rect dirty) | |||||
Mark the the area defined by dirty as needing to be drawn. | ||||||
void | invalidateDrawable(Drawable drawable) | |||||
Invalidates the specified Drawable. | ||||||
boolean | isClickable() | |||||
Indicates whether this view reacts to click events or not. | ||||||
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 | 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 | 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 | 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 | isSelected() | |||||
Indicates the selection state of this view. | ||||||
boolean | isShown() | |||||
Returns the visibility of this view and all of its ancestors | ||||||
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. |
||||||
final | 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. |
||||||
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 | onCreateContextMenu(ContextMenu menu) | |||||
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 | onDraw(Canvas canvas) | |||||
Implement this to do your drawing. | ||||||
void | onFinishInflate() | |||||
Finalize inflating a view from XML. | ||||||
void | onFocusChanged(boolean gainFocus, int direction, Rect previouslyFocusedRect) | |||||
Called by the view system when the focus state of this view changes. | ||||||
boolean | onKeyDown(int keyCode, KeyEvent event) | |||||
Default implementation of KeyEvent.Callback.onKeyMultiple(): perform press of the view when KEYCODE_DPAD_CENTER or KEYCODE_ENTER is released, if the view is enabled and clickable. | ||||||
boolean | onKeyMultiple(int keyCode, int repeatCount, KeyEvent event) | |||||
Default implementation of KeyEvent.Callback.onKeyMultiple(): always returns false (doesn't handle the event). | ||||||
boolean | onKeyShortcut(int keyCode, KeyEvent event) | |||||
Called when an unhandled key shortcut event occurs. | ||||||
boolean | onKeyUp(int keyCode, KeyEvent event) | |||||
Default implementation of KeyEvent.Callback.onKeyMultiple(): perform clicking of the view when KEYCODE_DPAD_CENTER or KEYCODE_ENTER is released. | ||||||
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 | onRestoreInstanceState(Parcelable state) | |||||
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. | ||||||
boolean | onTouchEvent(MotionEvent event) | |||||
Implement this method to handle touch screen motion events. | ||||||
boolean | onTrackballEvent(MotionEvent event) | |||||
Implement this method to handle trackball motion events. | ||||||
void | onWindowFocusChanged(boolean hasWindowFocus) | |||||
Called when the window containing this view gains or loses focus. | ||||||
void | onWindowVisibilityChanged(int visibility) | |||||
Called when the window containing has change its visibility (between GONE, INVISIBLE, and VISIBLE). | ||||||
boolean | performClick() | |||||
Call this view's OnClickListener, if it is defined. | ||||||
boolean | performLongClick() | |||||
Call this view's OnLongClickListener, if it is defined. | ||||||
boolean | post(Runnable action) | |||||
Causes the Runnable to be added to the message queue. | ||||||
boolean | postDelayed(Runnable action, long delayMillis) | |||||
Causes the Runnable to be added to the message queue, to be run after the specified amount of time elapses. | ||||||
void | postInvalidate() | |||||
Cause an invalidate to happen on a subsequent cycle through the event loop. | ||||||
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 | postInvalidateDelayed(long delayMilliseconds) | |||||
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 | refreshDrawableState() | |||||
Call this to force a view to update its drawable state. | ||||||
boolean | removeCallbacks(Runnable action) | |||||
Removes the specified Runnable from the message queue. | ||||||
final | boolean | requestFocus() | ||||
Call this to try to give focus to a specific view or to one of its descendants. | ||||||
boolean | requestFocus(int direction, Rect previouslyFocusedRect) | |||||
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 | 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(Rect rectangle, boolean immediate) | |||||
Request that a rectangle of this view be visible on the screen, scrolling if necessary just enough. | ||||||
boolean | requestRectangleOnScreen(Rect rectangle) | |||||
Request that a rectangle of this view be visible on the screen, scrolling if necessary just enough. | ||||||
static | int | resolveSize(int size, int measureSpec) | ||||
Utility to reconcile a desired size 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(Drawable who, Runnable what, 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 | setAnimation(Animation animation) | |||||
Sets the next animation to play for this view. | ||||||
void | setBackgroundColor(int color) | |||||
Sets the background color for this view. | ||||||
void | setBackgroundDrawable(Drawable d) | |||||
Set the background to a given Drawable, or remove the background. | ||||||
void | setBackgroundResource(int resid) | |||||
Set the background to a given resource. | ||||||
void | setClickable(boolean clickable) | |||||
Enables or disables click events for this view. | ||||||
void | setDrawingCacheBackgroundColor(int color) | |||||
Setting a solid background color for the drawing cache's bitmaps will improve perfromance 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 | 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 | 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 | 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 | setLayoutParams(ViewGroup.LayoutParams params) | |||||
Set the layout parameters associated with this view. | ||||||
void | setLongClickable(boolean longClickable) | |||||
Enables or disables long click events for this view. | ||||||
final | void | setMeasuredDimension(int measuredWidth, int measuredHeight) | ||||
This mehod must be called by onMeasure(int, int) to store the measured width and measured height. |
||||||
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) | |||||
Set the id of the view to use for the next focus | ||||||
void | setNextFocusLeftId(int nextFocusLeftId) | |||||
Set the id of the view to use for the next focus | ||||||
void | setNextFocusRightId(int nextFocusRightId) | |||||
Set the id of the view to use for the next focus | ||||||
void | setNextFocusUpId(int nextFocusUpId) | |||||
Set the id of the view to use for the next focus | ||||||
void | setOnClickListener(View.OnClickListener l) | |||||
Register a callback to be invoked when this view is clicked. | ||||||
void | setOnCreateContextMenuListener(View.OnCreateContextMenuListener l) | |||||
Register a callback to be invoked when the context menu for this view is being built. | ||||||
void | setOnFocusChangeListener(View.OnFocusChangeListener l) | |||||
Register a callback to be invoked when focus of this view changed. | ||||||
void | setOnKeyListener(View.OnKeyListener l) | |||||
Register a callback to be invoked when a key is pressed in this view. | ||||||
void | setOnLongClickListener(View.OnLongClickListener l) | |||||
Register a callback to be invoked when this view is clicked and held. | ||||||
void | setOnTouchListener(View.OnTouchListener l) | |||||
Register a callback to be invoked when a touch event is sent to this view. | ||||||
void | setPadding(int left, int top, int right, int bottom) | |||||
Sets the padding. | ||||||
void | setPressed(boolean pressed) | |||||
Sets the pressed that for this view. | ||||||
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 | setScrollBarStyle(int style) | |||||
Specify the style of the scrollbars. |
||||||
void | setSelected(boolean selected) | |||||
Changes the selection state of this view. | ||||||
void | setTag(Object tag) | |||||
Sets the tag associated with this view. | ||||||
void | setTouchDelegate(TouchDelegate delegate) | |||||
Sets the TouchDelegate for this View. | ||||||
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 | 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. | ||||||
boolean | showContextMenu() | |||||
Bring up the context menu for this view. | ||||||
void | startAnimation(Animation animation) | |||||
Start the specified animation now. | ||||||
void | unscheduleDrawable(Drawable who, Runnable what) | |||||
Cancels a scheduled action on a drawable. | ||||||
void | unscheduleDrawable(Drawable who) | |||||
Unschedule any events associated with the given Drawable. | ||||||
boolean | verifyDrawable(Drawable who) | |||||
If your view subclass is displaying its own Drawable objects, it should override this function and return true for any Drawable it is displaying. | ||||||
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. |
Object | clone() | |||||
Returns a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver. | ||||||
boolean | equals(Object o) | |||||
Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison. | ||||||
void | finalize() | |||||
Called by the virtual machine when there are no longer any (non-weak) references to the receiver. | ||||||
final | Class<? extends Object> | getClass() | ||||
Returns the unique instance of java.lang.Class which represents the class of the receiver. | ||||||
int | hashCode() | |||||
Returns an integer hash code for the receiver. | ||||||
final | void | notify() | ||||
Causes one thread which is wait ing on the receiver to be
made ready to run. |
||||||
final | void | notifyAll() | ||||
Causes all threads which are wait ing on the receiver to
be made ready to run. |
||||||
String | toString() | |||||
Returns a string containing a concise, human-readable description of the receiver. | ||||||
final | void | wait(long time, int frac) | ||||
Causes the thread which sent this message to be made not ready to run
either pending some change in the receiver (as indicated by
notify or notifyAll ) or the expiration of
the timeout. |
||||||
final | void | wait(long time) | ||||
Causes the thread which sent this message to be made not ready to run
either pending some change in the receiver (as indicated by
notify or notifyAll ) or the expiration of
the timeout. |
||||||
final | void | wait() | ||||
Causes the thread which sent this message to be made not ready to run
pending some change in the receiver (as indicated by notify
or notifyAll ). |
void | invalidateDrawable(Drawable who) | |||||
Called when the drawable needs to be redrawn. | ||||||
void | scheduleDrawable(Drawable who, Runnable what, long when) | |||||
A Drawable can call this to schedule the next frame of its animation. | ||||||
void | unscheduleDrawable(Drawable who, Runnable what) | |||||
A Drawable can call this to unschedule an action previously scheduled with scheduleDrawable(Drawable, Runnable, long). |
boolean | onKeyDown(int keyCode, KeyEvent event) | |||||
Called when a key down event has occurred. | ||||||
boolean | onKeyMultiple(int keyCode, int count, KeyEvent event) | |||||
Called when multiple down/up pairs of the same key have occurred in a row. | ||||||
boolean | onKeyUp(int keyCode, KeyEvent event) | |||||
Called when a key up event has occurred. |
alpha | The alpha (0..255) to apply to the view's drawing |
---|
Copyright 2007 Google Inc. | Build 0.9_r1-98467 - 14 Aug 2008 18:56 |