Added in API level 1

ShaderFactory

abstract class ShaderFactory
kotlin.Any
   ↳ android.graphics.drawable.ShapeDrawable.ShaderFactory

Base class defines a factory object that is called each time the drawable is resized (has a new width or height). Its resize() method returns a corresponding shader, or null. Implement this class if you'd like your ShapeDrawable to use a special android.graphics.Shader, such as a android.graphics.LinearGradient.

Summary

Public constructors

Public methods
abstract Shader!
resize(width: Int, height: Int)

Returns the Shader to be drawn when a Drawable is drawn.

Public constructors

ShaderFactory

ShaderFactory()

Public methods

resize

Added in API level 1
abstract fun resize(
    width: Int,
    height: Int
): Shader!

Returns the Shader to be drawn when a Drawable is drawn. The dimensions of the Drawable are passed because they may be needed to adjust how the Shader is configured for drawing. This is called by ShapeDrawable.setShape().

Parameters
width Int: the width of the Drawable being drawn
height Int: the heigh of the Drawable being drawn
Return
Shader! the Shader to be drawn