Share via


ViewPropertyAnimator.WithLayer Method

Definition

The View associated with this ViewPropertyAnimator will have its View#setLayerType(int, android.graphics.Paint) layer type set to View#LAYER_TYPE_HARDWARE for the duration of the next animation.

[Android.Runtime.Register("withLayer", "()Landroid/view/ViewPropertyAnimator;", "GetWithLayerHandler")]
public virtual Android.Views.ViewPropertyAnimator WithLayer ();
[<Android.Runtime.Register("withLayer", "()Landroid/view/ViewPropertyAnimator;", "GetWithLayerHandler")>]
abstract member WithLayer : unit -> Android.Views.ViewPropertyAnimator
override this.WithLayer : unit -> Android.Views.ViewPropertyAnimator

Returns

This object, allowing calls to methods in this class to be chained.

Attributes

Remarks

The View associated with this ViewPropertyAnimator will have its View#setLayerType(int, android.graphics.Paint) layer type set to View#LAYER_TYPE_HARDWARE for the duration of the next animation. As stated in the documentation for View#LAYER_TYPE_HARDWARE, the actual type of layer used internally depends on the runtime situation of the view. If the activity and this view are hardware-accelerated, then the layer will be accelerated as well. If the activity or the view is not accelerated, then the layer will effectively be the same as View#LAYER_TYPE_SOFTWARE.

This state is not persistent, either on the View or on this ViewPropertyAnimator: the layer type of the View will be restored when the animation ends to what it was when this method was called, and this setting on ViewPropertyAnimator is only valid for the next animation. Note that calling this method and then independently setting the layer type of the View (by a direct call to View#setLayerType(int, android.graphics.Paint)) will result in some inconsistency, including having the layer type restored to its pre-withLayer() value when the animation ends.

Java documentation for android.view.ViewPropertyAnimator.withLayer().

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

See also

  • <xref:Android.Views.View.SetLayerType(Android.Views.LayerType%2c+Android.Graphics.Paint)>