public class ScrollBarDrawable extends Drawable
Drawable.Callback, Drawable.ConstantState
Constructor and Description |
---|
ScrollBarDrawable() |
Modifier and Type | Method and Description |
---|---|
void |
draw(Canvas canvas)
Draw in its bounds (set via setBounds) respecting optional effects such
as alpha (set via setAlpha) and color filter (set via setColorFilter).
|
protected void |
drawThumb(Canvas canvas,
Rect bounds,
int offset,
int length,
boolean vertical) |
protected void |
drawTrack(Canvas canvas,
Rect bounds,
boolean vertical) |
boolean |
getAlwaysDrawHorizontalTrack()
Indicates whether the horizontal scrollbar track should always be drawn regardless of the
extent.
|
boolean |
getAlwaysDrawVerticalTrack()
Indicates whether the vertical scrollbar track should always be drawn regardless of the
extent.
|
int |
getOpacity()
Return the opacity/transparency of this Drawable.
|
int |
getSize(boolean vertical) |
protected void |
onBoundsChange(Rect bounds)
Override this in your subclass to change appearance if you recognize the
specified state.
|
void |
setAlpha(int alpha)
Specify an alpha value for the drawable.
|
void |
setAlwaysDrawHorizontalTrack(boolean alwaysDrawTrack)
Indicate whether the horizontal scrollbar track should always be drawn regardless of the
extent.
|
void |
setAlwaysDrawVerticalTrack(boolean alwaysDrawTrack)
Indicate whether the vertical scrollbar track should always be drawn regardless of the
extent.
|
void |
setColorFilter(ColorFilter cf)
Specify an optional colorFilter for the drawable.
|
void |
setHorizontalThumbDrawable(Drawable thumb) |
void |
setHorizontalTrackDrawable(Drawable track) |
void |
setParameters(int range,
int offset,
int extent,
boolean vertical) |
void |
setVerticalThumbDrawable(Drawable thumb) |
void |
setVerticalTrackDrawable(Drawable track) |
String |
toString()
Returns a string containing a concise, human-readable description of this
object.
|
clearColorFilter, copyBounds, copyBounds, createFromPath, createFromResourceStream, createFromResourceStream, createFromStream, createFromXml, createFromXmlInner, getBounds, getCallback, getChangingConfigurations, getConstantState, getCurrent, getIntrinsicHeight, getIntrinsicWidth, getLayoutDirection, getLayoutInsets, getLevel, getMinimumHeight, getMinimumWidth, getPadding, getState, getTransparentRegion, inflate, invalidateSelf, isStateful, isVisible, jumpToCurrentState, mutate, onLevelChange, onStateChange, resolveOpacity, scheduleSelf, setBounds, setBounds, setCallback, setChangingConfigurations, setColorFilter, setDither, setFilterBitmap, setLayoutDirection, setLevel, setState, setVisible, unscheduleSelf
public void setAlwaysDrawHorizontalTrack(boolean alwaysDrawTrack)
alwaysDrawTrack
- Set to true if the track should always be drawnpublic void setAlwaysDrawVerticalTrack(boolean alwaysDrawTrack)
alwaysDrawTrack
- Set to true if the track should always be drawnpublic boolean getAlwaysDrawVerticalTrack()
public boolean getAlwaysDrawHorizontalTrack()
public void setParameters(int range, int offset, int extent, boolean vertical)
public void draw(Canvas canvas)
Drawable
protected void onBoundsChange(Rect bounds)
Drawable
onBoundsChange
in class Drawable
protected void drawThumb(Canvas canvas, Rect bounds, int offset, int length, boolean vertical)
public void setVerticalThumbDrawable(Drawable thumb)
public void setVerticalTrackDrawable(Drawable track)
public void setHorizontalThumbDrawable(Drawable thumb)
public void setHorizontalTrackDrawable(Drawable track)
public int getSize(boolean vertical)
public void setAlpha(int alpha)
Drawable
public void setColorFilter(ColorFilter cf)
Drawable
setColorFilter
in class Drawable
public int getOpacity()
Drawable
PixelFormat
:
PixelFormat.UNKNOWN
,
PixelFormat.TRANSLUCENT
,
PixelFormat.TRANSPARENT
, or
PixelFormat.OPAQUE
.
Generally a Drawable should be as conservative as possible with the
value it returns. For example, if it contains multiple child drawables
and only shows one of them at a time, if only one of the children is
TRANSLUCENT and the others are OPAQUE then TRANSLUCENT should be
returned. You can use the method Drawable.resolveOpacity(int, int)
to perform a
standard reduction of two opacities to the appropriate single output.
Note that the returned value does not take into account a
custom alpha or color filter that has been applied by the client through
the Drawable.setAlpha(int)
or Drawable.setColorFilter(android.graphics.ColorFilter)
methods.
getOpacity
in class Drawable
PixelFormat
public String toString()
Object
getClass().getName() + '@' + Integer.toHexString(hashCode())
See Writing a useful
toString
method
if you intend implementing your own toString
method.