Udostępnij za pośrednictwem


View.Invalidate Method

Definition

Overloads

Invalidate()

Invalidate the whole view.

Invalidate(Rect)

Mark the area defined by dirty as needing to be drawn.

Invalidate(Int32, Int32, Int32, Int32)

Mark the area defined by the rect (l,t,r,b) as needing to be drawn.

Invalidate()

Invalidate the whole view.

[Android.Runtime.Register("invalidate", "()V", "GetInvalidateHandler")]
public virtual void Invalidate ();
[<Android.Runtime.Register("invalidate", "()V", "GetInvalidateHandler")>]
abstract member Invalidate : unit -> unit
override this.Invalidate : unit -> unit
Attributes

Remarks

Invalidate the whole view. If the view is visible, #onDraw(android.graphics.Canvas) will be called at some point in the future.

This must be called from a UI thread. To call from a non-UI thread, call #postInvalidate().

Java documentation for android.view.View.invalidate().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Invalidate(Rect)

Mark the area defined by dirty as needing to be drawn.

[Android.Runtime.Register("invalidate", "(Landroid/graphics/Rect;)V", "GetInvalidate_Landroid_graphics_Rect_Handler")]
public virtual void Invalidate (Android.Graphics.Rect? dirty);
[<Android.Runtime.Register("invalidate", "(Landroid/graphics/Rect;)V", "GetInvalidate_Landroid_graphics_Rect_Handler")>]
abstract member Invalidate : Android.Graphics.Rect -> unit
override this.Invalidate : Android.Graphics.Rect -> unit

Parameters

dirty
Rect

the rectangle representing the bounds of the dirty region

Attributes

Remarks

Mark the area defined by dirty as needing to be drawn. If the view is visible, #onDraw(android.graphics.Canvas) will be called at some point in the future.

This must be called from a UI thread. To call from a non-UI thread, call #postInvalidate().

<b>WARNING:</b> In API 19 and below, this method may be destructive to dirty.

This member is deprecated. The switch to hardware accelerated rendering in API 14 reduced the importance of the dirty rectangle. In API 21 the given rectangle is ignored entirely in favor of an internally-calculated area instead. Because of this, clients are encouraged to just call #invalidate().

Java documentation for android.view.View.invalidate(android.graphics.Rect).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Invalidate(Int32, Int32, Int32, Int32)

Mark the area defined by the rect (l,t,r,b) as needing to be drawn.

[Android.Runtime.Register("invalidate", "(IIII)V", "GetInvalidate_IIIIHandler")]
public virtual void Invalidate (int l, int t, int r, int b);
[<Android.Runtime.Register("invalidate", "(IIII)V", "GetInvalidate_IIIIHandler")>]
abstract member Invalidate : int * int * int * int -> unit
override this.Invalidate : int * int * int * int -> unit

Parameters

l
Int32

the left position of the dirty region

t
Int32

the top position of the dirty region

r
Int32

the right position of the dirty region

b
Int32

the bottom position of the dirty region

Attributes

Remarks

Mark the area defined by the rect (l,t,r,b) as needing to be drawn. The coordinates of the dirty rect are relative to the view. If the view is visible, #onDraw(android.graphics.Canvas) will be called at some point in the future.

This must be called from a UI thread. To call from a non-UI thread, call #postInvalidate().

This member is deprecated. The switch to hardware accelerated rendering in API 14 reduced the importance of the dirty rectangle. In API 21 the given rectangle is ignored entirely in favor of an internally-calculated area instead. Because of this, clients are encouraged to just call #invalidate().

Java documentation for android.view.View.invalidate(int, int, int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to