Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)
Android APIs
public static abstract class

ShapeDrawable.ShaderFactory

extends Object
java.lang.Object
   ↳ android.graphics.drawable.ShapeDrawable.ShaderFactory

Class Overview

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.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public ShapeDrawable.ShaderFactory ()

Added in API level 1

Public Methods

public abstract Shader resize (int width, int height)

Added in API level 1

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 the width of the Drawable being drawn
height the heigh of the Drawable being drawn
Returns
  • the Shader to be drawn