Most visited

Recently visited

Added in API level 1

ShapeDrawable.ShaderFactory

public static abstract class ShapeDrawable.ShaderFactory
extends Object

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


基类定义了一个工厂对象,每当drawable被调整大小(有一个新的宽度或高度)时被调用。 它的resize()方法返回一个相应的着色器,或者返回null。 实现这个类,如果你想你的ShapeDrawable使用特殊Shader ,如LinearGradient

Summary

Public constructors

ShapeDrawable.ShaderFactory()

Public methods

abstract Shader resize(int width, int height)

返回绘制Drawable时要绘制的着色器。

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)

返回绘制Drawable时要绘制的着色器。 Drawable的尺寸被传递,因为它们可能需要调整Shader的绘制配置。 这由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

Hooray!