Example usage for Java android.graphics.drawable GradientDrawable fields, constructors, methods, implement or subclass
The text is from its open source code.
int | RECTANGLE Shape is a rectangle, possibly with rounded corners |
int | OVAL Shape is an ellipse |
int | LINEAR_GRADIENT Gradient is linear (default.) |
int | RADIAL_GRADIENT Gradient is circular. |
int | SWEEP_GRADIENT Gradient is a sweep. |
GradientDrawable() | |
GradientDrawable(Orientation orientation, @ColorInt int[] colors) Create a new gradient drawable given an orientation and an array of colors for the gradient. | |
GradientDrawable(@NonNull GradientState state, @Nullable Resources res) Creates a new themed GradientDrawable based on the specified constant state. |
void | draw(Canvas canvas) |
ConstantState | getConstantState() |
int | getIntrinsicHeight() |
int | getIntrinsicWidth() |
void | invalidateSelf() Use the current Callback implementation to have this Drawable redrawn. |
Drawable | mutate() |
void | setAlpha(int alpha) |
void | setBounds(int left, int top, int right, int bottom) Specify a bounding rectangle for the Drawable. |
void | setColor(@ColorInt int argb) Changes this drawable to use a single color instead of a gradient. |
void | setColor(@Nullable ColorStateList colorStateList) Changes this drawable to use a single color state list instead of a gradient. |
void | setColorFilter(@Nullable ColorFilter colorFilter) |
void | setColorFilter(@ColorInt int color, @NonNull PorterDuff.Mode mode) Specify a color and Porter-Duff mode to be the color filter for this drawable. |
void | setColors(@ColorInt int[] colors) Sets the colors used to draw the gradient. |
void | setCornerRadii(@Nullable float[] radii) Specifies radii for each of the 4 corners. |
void | setCornerRadius(float radius) Specifies the radius for the corners of the gradient. |
void | setDither(boolean dither) |
void | setGradientCenter(float x, float y) Sets the position of the center of the gradient as a fraction of the width and height. |
void | setGradientRadius(float gradientRadius) Sets the radius of the gradient. |
void | setGradientType(@GradientType int gradient) Sets the type of gradient used by this drawable. |
void | setOrientation(Orientation orientation) Sets the orientation of the gradient defined in this drawable. |
void | setShape(@Shape int shape) Sets the type of shape used to draw the gradient. Note: changing this property will affect all instances of a drawable loaded from a resource. |
void | setSize(int width, int height) Sets the size of the shape drawn by this drawable. Note: changing this property will affect all instances of a drawable loaded from a resource. |
void | setStroke(int width, @ColorInt int color) Set the stroke width and color for the drawable. |
void | setStroke(int width, ColorStateList colorStateList) Set the stroke width and color state list for the drawable. |
void | setStroke(int width, @ColorInt int color, float dashWidth, float dashGap) Set the stroke width and color for the drawable. |
void | setStroke(int width, ColorStateList colorStateList, float dashWidth, float dashGap) Set the stroke width and color state list for the drawable. |
void | setUseLevel(boolean useLevel) Sets whether this drawable's level property will be used to scale the gradient. |