HexDrawable

open class HexDrawable(hexGridView: HexGridView, @ColorInt fillColor: Int = Color.WHITE) : Drawable

Optional background Drawable for children of a HexGridView that gives them the same shape as the View's grid hexagon.

For normal usage, you don't need to deal with this class at all, directly. The app:layout_hexBackground* attributes are available to apply this feature from layout XML, and the HexGridView.applyHexBackground function offers the same options in code. If you extend this class, you'll need to instantiate and set the drawable manually, but you still must use applyHexBackground to modify the inset or color.

The current implementation simply fills its area with a solid color, and sets its Outline to the grid View's hexagon shape, so that it can cast material shadows. The inset is accounted for during child layout, so this class is expected to draw right up to its bounds.

It is open to allow further customizations, like possibly using a Shader with the Paint instead of a solid color.

Constructors

Link copied to clipboard
constructor(hexGridView: HexGridView, @ColorInt fillColor: Int = Color.WHITE)

Properties

Link copied to clipboard

The color used to fill the drawable's area.

Functions

Link copied to clipboard
open override fun draw(canvas: Canvas)
Link copied to clipboard
open override fun getOpacity(): Int
Link copied to clipboard
open override fun getOutline(outline: Outline)
Link copied to clipboard
open override fun setAlpha(alpha: Int)
Link copied to clipboard
open override fun setColorFilter(colorFilter: ColorFilter?)