android.graphics.drawable
Class GradientDrawable

java.lang.Object
  extended by android.graphics.drawable.Drawable
      extended by android.graphics.drawable.GradientDrawable

public class GradientDrawable
extends Drawable


Nested Class Summary
static class GradientDrawable.Orientation
           
 
Nested classes/interfaces inherited from class android.graphics.drawable.Drawable
Drawable.Callback, Drawable.ConstantState
 
Field Summary
static int LINE
           
static int LINEAR_GRADIENT
           
static int OVAL
           
static int RADIAL_GRADIENT
           
static int RECTANGLE
           
static int RING
           
static int SWEEP_GRADIENT
           
 
Constructor Summary
GradientDrawable()
           
GradientDrawable(GradientDrawable.Orientation orientation, int[] colors)
           
 
Method Summary
 void draw(Canvas canvas)
           
 int getChangingConfigurations()
           
 Drawable.ConstantState getConstantState()
           
 int getIntrinsicHeight()
           
 int getIntrinsicWidth()
           
 int getOpacity()
           
 boolean getPadding(Rect padding)
           
 void inflate(Resources r, org.xmlpull.v1.XmlPullParser parser, AttributeSet attrs)
           
 Drawable mutate()
           
protected  void onBoundsChange(Rect r)
           
protected  boolean onLevelChange(int level)
           
 void setAlpha(int alpha)
           
 void setColor(int argb)
           
 void setColorFilter(ColorFilter cf)
           
 void setCornerRadii(float[] radii)
           
 void setCornerRadius(float radius)
           
 void setDither(boolean dither)
           
 void setGradientCenter(float x, float y)
           
 void setGradientRadius(float gradientRadius)
           
 void setGradientType(int gradient)
           
 void setShape(int shape)
           
 void setSize(int width, int height)
           
 void setStroke(int width, int color)
           
 void setStroke(int width, int color, float dashWidth, float dashGap)
           
 void setUseLevel(boolean useLevel)
           
 
Methods inherited from class android.graphics.drawable.Drawable
clearColorFilter, copyBounds, copyBounds, createFromPath, createFromResourceStream, createFromResourceStream, createFromStream, createFromXml, createFromXmlInner, getBounds, getCallback, getCurrent, getLevel, getMinimumHeight, getMinimumWidth, getState, getTransparentRegion, invalidateSelf, isStateful, isVisible, jumpToCurrentState, onStateChange, resolveOpacity, scheduleSelf, setBounds, setBounds, setCallback, setChangingConfigurations, setColorFilter, setFilterBitmap, setLevel, setState, setVisible, unscheduleSelf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RECTANGLE

public static final int RECTANGLE
See Also:
Constant Field Values

OVAL

public static final int OVAL
See Also:
Constant Field Values

LINE

public static final int LINE
See Also:
Constant Field Values

RING

public static final int RING
See Also:
Constant Field Values

LINEAR_GRADIENT

public static final int LINEAR_GRADIENT
See Also:
Constant Field Values

RADIAL_GRADIENT

public static final int RADIAL_GRADIENT
See Also:
Constant Field Values

SWEEP_GRADIENT

public static final int SWEEP_GRADIENT
See Also:
Constant Field Values
Constructor Detail

GradientDrawable

public GradientDrawable()

GradientDrawable

public GradientDrawable(GradientDrawable.Orientation orientation,
                        int[] colors)
Method Detail

getPadding

public boolean getPadding(Rect padding)
Overrides:
getPadding in class Drawable

setCornerRadii

public void setCornerRadii(float[] radii)

setCornerRadius

public void setCornerRadius(float radius)

setStroke

public void setStroke(int width,
                      int color)

setStroke

public void setStroke(int width,
                      int color,
                      float dashWidth,
                      float dashGap)

setSize

public void setSize(int width,
                    int height)

setShape

public void setShape(int shape)

setGradientType

public void setGradientType(int gradient)

setGradientCenter

public void setGradientCenter(float x,
                              float y)

setGradientRadius

public void setGradientRadius(float gradientRadius)

setUseLevel

public void setUseLevel(boolean useLevel)

draw

public void draw(Canvas canvas)
Specified by:
draw in class Drawable

setColor

public void setColor(int argb)

getChangingConfigurations

public int getChangingConfigurations()
Overrides:
getChangingConfigurations in class Drawable

setAlpha

public void setAlpha(int alpha)
Specified by:
setAlpha in class Drawable

setDither

public void setDither(boolean dither)
Overrides:
setDither in class Drawable

setColorFilter

public void setColorFilter(ColorFilter cf)
Specified by:
setColorFilter in class Drawable

getOpacity

public int getOpacity()
Specified by:
getOpacity in class Drawable

onBoundsChange

protected void onBoundsChange(Rect r)
Overrides:
onBoundsChange in class Drawable

onLevelChange

protected boolean onLevelChange(int level)
Overrides:
onLevelChange in class Drawable

inflate

public void inflate(Resources r,
                    org.xmlpull.v1.XmlPullParser parser,
                    AttributeSet attrs)
             throws org.xmlpull.v1.XmlPullParserException,
                    IOException
Overrides:
inflate in class Drawable
Throws:
org.xmlpull.v1.XmlPullParserException
IOException

getIntrinsicWidth

public int getIntrinsicWidth()
Overrides:
getIntrinsicWidth in class Drawable

getIntrinsicHeight

public int getIntrinsicHeight()
Overrides:
getIntrinsicHeight in class Drawable

getConstantState

public Drawable.ConstantState getConstantState()
Overrides:
getConstantState in class Drawable

mutate

public Drawable mutate()
Overrides:
mutate in class Drawable


Copyright © 2008-2012. All Rights Reserved.