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!