Skip to content

Most visited

Recently visited

navigation

ShapeDrawable.ShaderFactory

public static abstract class ShapeDrawable.ShaderFactory
extends Object

java.lang.Object
   ↳ 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 Shader, such as a LinearGradient.

Summary

Public constructors

ShapeDrawable.ShaderFactory()

Public methods

abstract Shader resize(int width, int height)

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

Inherited methods

From class java.lang.Object

Public constructors

ShapeDrawable.ShaderFactory

Added in API level 1
ShapeDrawable.ShaderFactory ()

Public methods

resize

Added in API level 1
Shader resize (int width, 
                int height)

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
Returns
Shader the Shader to be drawn
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a one-minute survey?
Help us improve Android tools and documentation.