public class RoundDrawable
extends android.graphics.drawable.GradientDrawable
Drawable。
setBgData(ColorStateList) 设置背景色。setStrokeData(int, ColorStateList) 设置描边大小、描边颜色。setIsRadiusAdjustBounds(boolean) 设置圆角大小是否自动适应为 View 的高度的一半, 默认为 true。| Constructor and Description |
|---|
RoundDrawable() |
| Modifier and Type | Method and Description |
|---|---|
static RoundDrawable |
fromAttributeSet(android.content.Context context,
android.util.AttributeSet attrs)
根据 AttributeSet
|
boolean |
isStateful() |
protected void |
onBoundsChange(android.graphics.Rect r) |
protected boolean |
onStateChange(int[] stateSet) |
void |
setBgData(android.content.res.ColorStateList colors)
设置按钮的背景色(只支持纯色,不支持 Bitmap 或 Drawable)
|
void |
setIsRadiusAdjustBounds(boolean isRadiusAdjustBounds)
设置圆角大小是否自动适应为 View 的高度的一半
|
void |
setStrokeData(int width,
android.content.res.ColorStateList colors)
设置按钮的描边粗细和颜色
|
applyTheme, canApplyTheme, draw, getAlpha, getChangingConfigurations, getColor, getColorFilter, getColors, getConstantState, getCornerRadii, getCornerRadius, getGradientCenterX, getGradientCenterY, getGradientRadius, getGradientType, getIntrinsicHeight, getIntrinsicWidth, getOpacity, getOrientation, getOutline, getPadding, getShape, getUseLevel, inflate, mutate, onLevelChange, setAlpha, setColor, setColor, setColorFilter, setColors, setCornerRadii, setCornerRadius, setDither, setGradientCenter, setGradientRadius, setGradientType, setOrientation, setShape, setSize, setStroke, setStroke, setStroke, setStroke, setTintList, setTintMode, setUseLevelclearColorFilter, copyBounds, copyBounds, createFromPath, createFromResourceStream, createFromResourceStream, createFromStream, createFromXml, createFromXml, createFromXmlInner, createFromXmlInner, getBounds, getCallback, getCurrent, getDirtyBounds, getHotspotBounds, getLayoutDirection, getLevel, getMinimumHeight, getMinimumWidth, getState, getTransparentRegion, inflate, invalidateSelf, isAutoMirrored, isFilterBitmap, isVisible, jumpToCurrentState, onLayoutDirectionChanged, resolveOpacity, scheduleSelf, setAutoMirrored, setBounds, setBounds, setCallback, setChangingConfigurations, setColorFilter, setFilterBitmap, setHotspot, setHotspotBounds, setLayoutDirection, setLevel, setState, setTint, setVisible, unscheduleSelfpublic void setBgData(android.content.res.ColorStateList colors)
public void setStrokeData(int width,
android.content.res.ColorStateList colors)
public void setIsRadiusAdjustBounds(boolean isRadiusAdjustBounds)
protected boolean onStateChange(int[] stateSet)
onStateChange in class android.graphics.drawable.GradientDrawablepublic boolean isStateful()
isStateful in class android.graphics.drawable.GradientDrawableprotected void onBoundsChange(android.graphics.Rect r)
onBoundsChange in class android.graphics.drawable.GradientDrawablepublic static RoundDrawable fromAttributeSet(android.content.Context context, android.util.AttributeSet attrs)
context - attrs -