Android 12 Developer Preview is here! Try it out, and give us your feedback!

DrawerArrowDrawable

open class DrawerArrowDrawable : Drawable
kotlin.Any
   ↳ 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(float).

Summary

Constants
static Int

Direction to make the arrow point to the end.

static Int

Direction to make the arrow point towards the left.

static Int

Direction to make the arrow point towards the right.

static Int

Direction to make the arrow point towards the start.

Public constructors
<init>(context: Context!)

Public methods
open Unit
draw(canvas: Canvas)

open Float

Returns the length of the arrow head (from tip to edge, perpendicular to the shaft), in pixels.

open Float

Returns the arrow shaft length in pixels.

open Float

The length of the bars when they are parallel to each other.

open Float

Returns the thickness (stroke width) of the bars.

open Int

Returns the color of the drawable.

open Int

Returns the arrow direction.

open Float

Returns the max gap between the bars when they are parallel to each other.

open Int

open Int

open Int

Paint!

Returns the paint instance used for all drawing.

open Float

Returns the current progress of the arrow.

open Boolean

Returns whether the bars should rotate or not during the transition.

open Unit
setAlpha(alpha: Int)

open Unit

Sets the length of the arrow head (from tip to edge, perpendicular to the shaft).

open Unit

Sets the arrow shaft length.

open Unit

Sets the length of the bars when they are parallel to each other.

open Unit

Sets the thickness (stroke size) for the bars.

open Unit
setColor(@ColorInt color: Int)

Sets the color of the drawable.

open Unit
setColorFilter(colorFilter: ColorFilter?)

open Unit
setDirection(direction: Int)

Set the arrow direction.

open Unit

Sets the max gap between the bars when they are parallel to each other.

open Unit
setProgress(@FloatRange(0.0, 1.0) progress: Float)

Set the progress of the arrow.

open Unit

Returns whether the bars should rotate or not during the transition.

open Unit
setVerticalMirror(verticalMirror: Boolean)

If set, canvas is flipped when progress reached to end and going back to start.

Constants

ARROW_DIRECTION_END

static val ARROW_DIRECTION_END: Int

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.

Value: 3

ARROW_DIRECTION_LEFT

static val ARROW_DIRECTION_LEFT: Int

Direction to make the arrow point towards the left.

Value: 0

ARROW_DIRECTION_RIGHT

static val ARROW_DIRECTION_RIGHT: Int

Direction to make the arrow point towards the right.

Value: 1

ARROW_DIRECTION_START

static val ARROW_DIRECTION_START: Int

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.

Value: 2

See Also