Register now for Android Dev Summit 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 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(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(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

Public constructors

<init>

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

Public methods

draw

open fun draw(canvas: Canvas!): Unit

getArrowHeadLength

open fun getArrowHeadLength(): Float

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

getArrowShaftLength

open fun getArrowShaftLength(): Float

Returns the arrow shaft length in pixels.

getBarLength

open fun getBarLength(): Float

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

getBarThickness

open fun getBarThickness(): Float

Returns the thickness (stroke width) of the bars.

getColor

open fun getColor(): Int

Returns the color of the drawable.

getDirection

open fun getDirection(): Int

Returns the arrow direction.

getGapSize

open fun getGapSize(): Float

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

See Also

getIntrinsicHeight

open fun getIntrinsicHeight(): Int

getIntrinsicWidth

open fun getIntrinsicWidth(): Int

getOpacity

open fun getOpacity(): Int

getPaint

fun getPaint(): Paint!

Returns the paint instance used for all drawing.

getProgress

open fun getProgress(): Float

Returns the current progress of the arrow.

isSpinEnabled

open fun isSpinEnabled(): Boolean

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

setAlpha

open fun setAlpha(alpha: Int): 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

setArrowShaftLength

open fun setArrowShaftLength(length: Float): Unit

Sets the arrow shaft length.

Parameters
length Float: the length in pixels

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

setBarThickness

open fun setBarThickness(width: Float): Unit

Sets the thickness (stroke size) for the bars.

Parameters
width Float: stroke width in pixels

setColor

open fun setColor(color: Int): Unit

Sets the color of the drawable.

setColorFilter

open fun setColorFilter(colorFilter: ColorFilter!): Unit

setDirection

open fun setDirection(direction: Int): Unit

Set the arrow direction.

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

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.

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

setVerticalMirror

open fun setVerticalMirror(verticalMirror: Boolean): Unit

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