DrawerArrowDrawable
public class DrawerArrowDrawable extends Drawable
| java.lang.Object | ||
| ↳ | android.graphics.drawable.Drawable | |
| ↳ | androidx.appcompat.graphics.drawable.DrawerArrowDrawable |
A drawable that can draw a "Drawer hamburger" menu or an arrow and animate between them.
The progress between the two states is controlled via setProgress.
Summary
Constants |
|
|---|---|
static final int |
Direction to make the arrow point to the end. |
static final int |
Direction to make the arrow point towards the left. |
static final int |
Direction to make the arrow point towards the right. |
static final int |
Direction to make the arrow point towards the start. |
Public constructors |
|---|
DrawerArrowDrawable(Context context) |
Public methods |
|
|---|---|
void |
|
float |
Returns the length of the arrow head (from tip to edge, perpendicular to the shaft), in pixels. |
float |
Returns the arrow shaft length in pixels. |
float |
The length of the bars when they are parallel to each other. |
float |
Returns the thickness (stroke width) of the bars. |
@ColorInt int |
getColor()Returns the color of the drawable. |
int |
Returns the arrow direction. |
float |
Returns the max gap between the bars when they are parallel to each other. |
int |
|
int |
|
int |
This method is deprecated. |
final Paint |
getPaint()Returns the paint instance used for all drawing. |
@FloatRange(from = 0.0, to = 1.0) float |
Returns the current progress of the arrow. |
boolean |
Returns whether the bars should rotate or not during the transition. |
void |
setAlpha(int alpha) |
void |
setArrowHeadLength(float length)Sets the length of the arrow head (from tip to edge, perpendicular to the shaft). |
void |
setArrowShaftLength(float length)Sets the arrow shaft length. |
void |
setBarLength(float length)Sets the length of the bars when they are parallel to each other. |
void |
setBarThickness(float width)Sets the thickness (stroke size) for the bars. |
void |
Sets the color of the drawable. |
void |
setColorFilter(ColorFilter colorFilter) |
void |
setDirection(int direction)Set the arrow direction. |
void |
setGapSize(float gap)Sets the max gap between the bars when they are parallel to each other. |
void |
setProgress(@FloatRange(from = 0.0, to = 1.0) float progress)Set the progress of the arrow. |
void |
setSpinEnabled(boolean enabled)Returns whether the bars should rotate or not during the transition. |
void |
setVerticalMirror(boolean verticalMirror)If set, canvas is flipped when progress reached to end and going back to start. |
Inherited methods |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Constants
ARROW_DIRECTION_END
public static final int ARROW_DIRECTION_END = 3
Direction to make the arrow point to the end.
When used in a view with a RTL layout direction, this is the same as ARROW_DIRECTION_LEFT, otherwise it is the same as ARROW_DIRECTION_RIGHT.
| See also | |
|---|---|
setDirection |
|
getDirection |
ARROW_DIRECTION_LEFT
public static final int ARROW_DIRECTION_LEFT = 0
Direction to make the arrow point towards the left.
| See also | |
|---|---|
setDirection |
|
getDirection |
ARROW_DIRECTION_RIGHT
public static final int ARROW_DIRECTION_RIGHT = 1
Direction to make the arrow point towards the right.
| See also | |
|---|---|
setDirection |
|
getDirection |
ARROW_DIRECTION_START
public static final int ARROW_DIRECTION_START = 2
Direction to make the arrow point towards the start.
When used in a view with a RTL layout direction, this is the same as ARROW_DIRECTION_RIGHT, otherwise it is the same as ARROW_DIRECTION_LEFT.
| See also | |
|---|---|
setDirection |
|
getDirection |
Public constructors
DrawerArrowDrawable
public DrawerArrowDrawable(Context context)
| Parameters | |
|---|---|
Context context |
used to get the configuration for the drawable from |
Public methods
getArrowHeadLength
public float getArrowHeadLength()
Returns the length of the arrow head (from tip to edge, perpendicular to the shaft), in pixels.
getArrowShaftLength
public float getArrowShaftLength()
Returns the arrow shaft length in pixels.
getBarLength
public float getBarLength()
The length of the bars when they are parallel to each other.
getBarThickness
public float getBarThickness()
Returns the thickness (stroke width) of the bars.
getGapSize
public float getGapSize()
Returns the max gap between the bars when they are parallel to each other.
| See also | |
|---|---|
getGapSize |
getPaint
public final Paint getPaint()
Returns the paint instance used for all drawing.
getProgress
public @FloatRange(from = 0.0, to = 1.0) float getProgress()
Returns the current progress of the arrow.
isSpinEnabled
public boolean isSpinEnabled()
Returns whether the bars should rotate or not during the transition.
| See also | |
|---|---|
setSpinEnabled |
setArrowHeadLength
public void setArrowHeadLength(float length)
Sets the length of the arrow head (from tip to edge, perpendicular to the shaft).
| Parameters | |
|---|---|
float length |
the length in pixels |
setArrowShaftLength
public void setArrowShaftLength(float length)
Sets the arrow shaft length.
| Parameters | |
|---|---|
float length |
the length in pixels |
setBarLength
public void setBarLength(float length)
Sets the length of the bars when they are parallel to each other.
| Parameters | |
|---|---|
float length |
the length in pixels |
setBarThickness
public void setBarThickness(float width)
Sets the thickness (stroke size) for the bars.
| Parameters | |
|---|---|
float width |
stroke width in pixels |
setGapSize
public void setGapSize(float gap)
Sets the max gap between the bars when they are parallel to each other.
| Parameters | |
|---|---|
float gap |
the gap in pixels |
| See also | |
|---|---|
getGapSize |
setProgress
public void setProgress(@FloatRange(from = 0.0, to = 1.0) float progress)
Set the progress of the arrow.
A value of 0.0 indicates that the arrow should be drawn in its starting position. A value of 1.0 indicates that the arrow should be drawn in its ending position.
setSpinEnabled
public void setSpinEnabled(boolean enabled)
Returns whether the bars should rotate or not during the transition.
| Parameters | |
|---|---|
boolean enabled |
true if the bars should rotate. |
| See also | |
|---|---|
isSpinEnabled |
setVerticalMirror
public void setVerticalMirror(boolean verticalMirror)
If set, canvas is flipped when progress reached to end and going back to start.