Dela via


View.SetLayerType(LayerType, Paint) Method

Definition

Specifies the type of layer backing this view.

[Android.Runtime.Register("setLayerType", "(ILandroid/graphics/Paint;)V", "GetSetLayerType_ILandroid_graphics_Paint_Handler")]
public virtual void SetLayerType (Android.Views.LayerType layerType, Android.Graphics.Paint? paint);
[<Android.Runtime.Register("setLayerType", "(ILandroid/graphics/Paint;)V", "GetSetLayerType_ILandroid_graphics_Paint_Handler")>]
abstract member SetLayerType : Android.Views.LayerType * Android.Graphics.Paint -> unit
override this.SetLayerType : Android.Views.LayerType * Android.Graphics.Paint -> unit

Parameters

layerType
LayerType

The type of layer to use with this view, must be one of #LAYER_TYPE_NONE, #LAYER_TYPE_SOFTWARE or #LAYER_TYPE_HARDWARE

paint
Paint

The paint used to compose the layer. This argument is optional and can be null. It is ignored when the layer type is #LAYER_TYPE_NONE

Attributes

Remarks

Specifies the type of layer backing this view. The layer can be #LAYER_TYPE_NONE, #LAYER_TYPE_SOFTWARE or #LAYER_TYPE_HARDWARE.

A layer is associated with an optional android.graphics.Paint instance that controls how the layer is composed on screen. The following properties of the paint are taken into account when composing the layer:

<ul> <li>android.graphics.Paint#getAlpha() Translucency (alpha)</li> <li>android.graphics.Paint#getXfermode() Blending mode</li> <li>android.graphics.Paint#getColorFilter() Color filter</li> </ul>

If this view has an alpha value set to < 1.0 by calling #setAlpha(float), the alpha value of the layer's paint is superseded by this view's alpha value.

Refer to the documentation of #LAYER_TYPE_NONE, #LAYER_TYPE_SOFTWARE and #LAYER_TYPE_HARDWARE for more information on when and how to use layers.

Java documentation for android.view.View.setLayerType(int, android.graphics.Paint).

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