Example usage for Java android.widget ImageView fields, constructors, methods, implement or subclass
The text is from its open source code.
ImageView(Context context) | |
ImageView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) | |
ImageView(Context context, @Nullable AttributeSet attrs) |
void | addOnLayoutChangeListener(OnLayoutChangeListener listener) Add a listener that will be called when the bounds of the view change due to layout processing. |
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() Calling this method is equivalent to calling |
void | clearAnimation() Cancels any animations for this view. |
void | clearColorFilter() Removes the image's android.graphics.ColorFilter . |
void | destroyDrawingCache() Frees the resources used by the drawing cache. |
void | draw(Canvas canvas) Manually render this view (and all of its children) to the given Canvas. |
T | findViewById(@IdRes int id) Finds the first descendant view with the given ID, the view itself if the ID matches #getId() , or null if the ID is invalid (< 0) or there is no matching view in the hierarchy. |
float | getAlpha() The opacity of the view. |
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. |
int | getBottom() Bottom position of this view relative to its parent. |
Context | getContext() Returns the context the view is running in, through which it can access the current theme, resources, etc. |
Drawable | getDrawable() Gets the current Drawable, or null if no Drawable has been assigned. |
Bitmap | getDrawingCache() Calling this method is equivalent to calling |
boolean | getGlobalVisibleRect(Rect r) |
int | getHeight() Return the height of your view. |
int | getId() Returns this view's identifier. |
Matrix | getImageMatrix() Returns the view's optional matrix. |
ViewGroup.LayoutParams | getLayoutParams() Get the LayoutParams associated with this view. |
int | getLeft() Left position of this view relative to its parent. |
void | getLocationOnScreen(@Size(2) int[] outLocation) Computes the coordinates of this view on the screen. |
Matrix | getMatrix() The transform matrix of this view, which is calculated based on the current rotation, scale, and pivot properties. |
int | getMaxHeight() The maximum height of this view. |
int | getMaxWidth() The maximum width of this view. |
int | getMeasuredHeight() Like #getMeasuredHeightAndState() , but only returns the raw height component (that is the result is masked by #MEASURED_SIZE_MASK ). |
int | getMeasuredWidth() Like #getMeasuredWidthAndState() , but only returns the raw width component (that is the result is masked by #MEASURED_SIZE_MASK ). |
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. |
ViewParent | getParent() Gets the parent of this view. |
Resources | getResources() Returns the resources associated with this view. |
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. |
ScaleType | getScaleType() Returns the current ScaleType that is used to scale the bounds of an image to the bounds of the ImageView. |
Object | getTag() Returns this view's tag. |
Object | getTag(int key) Returns the tag associated with this view and the specified key. |
int | getTop() Top position of this view relative to its parent. |
String | getTransitionName() Returns the name of the View to be used to identify Views in Transitions. |
ViewTreeObserver | getViewTreeObserver() Returns the ViewTreeObserver for this view's hierarchy. |
int | getVisibility() Returns the visibility status for this view. |
int | getWidth() Return the width of your view. |
IBinder | getWindowToken() Retrieve a unique token identifying the window this view is attached to. |
void | invalidate() Invalidate the whole view. |
boolean | isInEditMode() Indicates whether this View is currently in edit mode. |
boolean | isSelected() Indicates the selection state of 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. |
void | measure(int widthMeasureSpec, int heightMeasureSpec) This is called to find out how big a view should be. |
boolean | performClick() Call this view's OnClickListener, 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. |
boolean | removeCallbacks(Runnable action) Removes the specified Runnable from the message queue. |
void | removeOnLayoutChangeListener(OnLayoutChangeListener listener) Remove a listener for layout changes. |
boolean | requestFocus() 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. |
void | setActivated(boolean activated) Changes the activated state of this view. |
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) Sets the alpha value that should be applied to the image. |
void | setAnimation(Animation animation) Sets the next animation to play for this view. |
void | setBackground(Drawable background) Set the background to a given Drawable, or remove the background. |
void | setBackgroundColor(@ColorInt int color) Sets the background color for this view. |
void | setBackgroundDrawable(Drawable background) |
void | setBackgroundResource(@DrawableRes int resid) Set the background to a given resource. |
void | setClickable(boolean clickable) Enables or disables click events for this view. |
void | setColorFilter(int color) Set a tinting option for the image. |
void | setColorFilter(ColorFilter cf) Apply an arbitrary colorfilter to the image. |
void | setColorFilter(int color, PorterDuff.Mode mode) Sets a tinting option for the image. |
void | setContentDescription(CharSequence contentDescription) Sets the View 's content description. |
void | setDrawingCacheEnabled(boolean enabled) Enables or disables the drawing cache. |
void | setEnabled(boolean enabled) Set the enabled state of this view. |
void | setFocusable(boolean focusable) Set whether this view can receive the focus. |
void | setHasTransientState(boolean hasTransientState) Set whether this view is currently tracking transient state that the framework should attempt to preserve when possible. |
void | setId(@IdRes int id) Sets the identifier for this view. |
void | setImageAlpha(int alpha) Sets the alpha value that should be applied to the image. |
void | setImageBitmap(Bitmap bm) Sets a Bitmap as the content of this ImageView. |
void | setImageDrawable(@Nullable Drawable drawable) Sets a drawable as the content of this ImageView. |
void | setImageLevel(int level) Sets the image level, when it is constructed from a android.graphics.drawable.LevelListDrawable . |
void | setImageMatrix(Matrix matrix) Adds a transformation Matrix that is applied to the view's drawable when it is drawn. |
void | setImageResourceAsync") public void setImageResource(@DrawableRes int resId) Sets a drawable as the content of this ImageView. |
void | setImageState(int[] state, boolean merge) Set the state of the current android.graphics.drawable.StateListDrawable . |
void | setImageTintList(@Nullable ColorStateList tint) Applies a tint to the image drawable. |
void | setImageURIAsync") public void setImageURI(@Nullable Uri uri) Sets the content of this ImageView to the specified Uri. |
void | setLayerType(int layerType, @Nullable Paint paint) Specifies the type of layer backing this view. |
void | setLayoutParams(ViewGroup.LayoutParams params) Set the layout parameters associated with this view. |
void | setLeft(int left) Sets the left position of this view relative to its parent. |
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 | setMinimumHeight(int minHeight) Sets the minimum height of the view. |
void | setMinimumWidth(int minWidth) Sets the minimum width of the view. |
void | setOnClickListener(@Nullable OnClickListener l) Register a callback to be invoked when this view is clicked. |
void | setOnCreateContextMenuListener(OnCreateContextMenuListener l) Register a callback to be invoked when the context menu for this view is being built. |
void | setOnDragListener(OnDragListener l) Register a drag event listener callback object for this View. |
void | setOnFocusChangeListener(OnFocusChangeListener l) Register a callback to be invoked when focus of this view changed. |
void | setOnGenericMotionListener(OnGenericMotionListener l) Register a callback to be invoked when a generic motion event is sent to this view. |
void | setOnLongClickListener(@Nullable OnLongClickListener l) Register a callback to be invoked when this view is clicked and held. |
void | setOnTouchListener(OnTouchListener l) Register a callback to be invoked when a touch event is sent to this view. |
void | setOutlineProvider(ViewOutlineProvider provider) Sets the ViewOutlineProvider of the view, which generates the Outline that defines the shape of the shadow it casts, and enables outline clipping. |
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 #setRotation(float) rotated and #setScaleX(float) scaled . |
void | setPivotY(float pivotY) Sets the y location of the point around which the view is #setRotation(float) rotated and #setScaleY(float) scaled . |
void | setRotation(float rotation) Sets the degrees that the view is rotated around the pivot point. |
void | setRotationY(float rotationY) Sets the degrees that the view is rotated around the vertical axis through the pivot point. |
void | setScaleType(ScaleType scaleType) Controls how the image should be resized or moved to match the size of this ImageView. |
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 | setSelected(boolean selected) |
void | setStateListAnimator(StateListAnimator stateListAnimator) Attaches the provided StateListAnimator to this View. |
void | setTag(final Object tag) Sets the tag associated with this view. |
void | setTag(int key, final Object tag) Sets a tag associated with this view and a key. |
void | setTop(int top) Sets the top position of this view relative to its parent. |
void | setTransitionName(String transitionName) Sets the name of the View to be used to identify Views in Transitions. |
void | setTranslationX(float translationX) Sets the horizontal location of this view relative to its #getLeft() left position. |
void | setTranslationY(float translationY) Sets the vertical location of this view relative to its #getTop() top position. |
void | setVisibility(int visibility) |
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. |
void | startAnimation(Animation animation) Start the specified animation now. |
String | toString() |