Save the date! Android Dev Summit is coming to Sunnyvale, CA on Oct 23-24, 2019.

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 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.

static Int

Direction to make the arrow point to the end.

Public constructors
<init>(context: Context!)

Public methods
open Float

Returns the thickness (stroke width) of the bars.

open Unit
draw(canvas: Canvas!)

open Unit

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

open Float

Returns the current progress of the arrow.

open Unit

Sets the arrow shaft length.

open Float

Returns the arrow shaft length in pixels.

open Unit

Sets the thickness (stroke size) for the bars.

open Unit

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

open Unit
setAlpha(alpha: Int)

open Float

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

open Unit

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

open Int

Returns the color of the drawable.

open Unit
setDirection(direction: Int)

Set the arrow direction.

open Int

open Unit
setVerticalMirror(verticalMirror: Boolean)

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

open Unit
setProgress(progress: Float)

Set the progress of the arrow.

open Boolean

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

open Int

open Float

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

open Int

open Float

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

open Unit

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

Paint!

Returns the paint instance used for all drawing.

open Unit
setColorFilter(colorFilter: ColorFilter!)

open Unit
setColor(color: Int)

Sets the color of the drawable.

open Int

Returns the arrow direction.

Constants

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

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

Public constructors

<init>

DrawerArrowDrawable(context: Context!)
Parameters
context Context!: used to get the configuration for the drawable from

Public methods

getBarThickness

open fun getBarThickness(): Float

Returns the thickness (stroke width) of the bars.

draw

open fun draw(canvas: Canvas!): Unit

setArrowHeadLength

open fun setArrowHeadLength(length: Float): Unit

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

Parameters
length Float: the length in pixels

getProgress

open fun getProgress(): Float

Returns the current progress of the arrow.

setArrowShaftLength

open fun setArrowShaftLength(length: Float): Unit

Sets the arrow shaft length.

Parameters
length Float: the length in pixels

getArrowShaftLength

open fun getArrowShaftLength(): Float

Returns the arrow shaft length in pixels.

setBarThickness

open fun setBarThickness(width: Float): Unit

Sets the thickness (stroke size) for the bars.

Parameters
width Float: stroke width in pixels

setSpinEnabled

open fun setSpinEnabled(enabled: Boolean): Unit

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

Parameters
enabled Boolean: true if the bars should rotate.

See Also

setAlpha

open fun setAlpha(alpha: Int): Unit

getArrowHeadLength

open fun getArrowHeadLength(): Float

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

setGapSize

open fun setGapSize(gap: Float): Unit

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

Parameters
gap Float: the gap in pixels

See Also

getColor

open fun getColor(): Int

Returns the color of the drawable.

setDirection

open fun setDirection(direction: Int): Unit

Set the arrow direction.

getOpacity

open fun getOpacity(): Int

setVerticalMirror

open fun setVerticalMirror(verticalMirror: Boolean): Unit

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

setProgress

open fun setProgress(progress: Float): Unit

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.

isSpinEnabled

open fun isSpinEnabled(): Boolean

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

getIntrinsicWidth

open fun getIntrinsicWidth(): Int

getBarLength

open fun getBarLength(): Float

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

getIntrinsicHeight

open fun getIntrinsicHeight(): Int

getGapSize

open fun getGapSize(): Float

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

See Also

setBarLength

open fun setBarLength(length: Float): Unit

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

Parameters
length Float: the length in pixels

getPaint

fun getPaint(): Paint!

Returns the paint instance used for all drawing.

setColorFilter

open fun setColorFilter(colorFilter: ColorFilter!): Unit

setColor

open fun setColor(color: Int): Unit

Sets the color of the drawable.

getDirection

open fun getDirection(): Int

Returns the arrow direction.