Repository navigation
Intro
All of the Examples use the pertinent framework's ConstraintLayout
component, and its circular positioning functionality.
The View versions use the HexagonDrawable class as the children's
backgrounds to draw the actual shape. A <drawable> is created in resources so
we can use it with the android:background attribute. It's been designed to
take a simple tint using android:backgroundTint so we can set different colors
in the layout, as well. It's also been set up to recognize and process a custom
attribute that allows specifying the hexagon's orientation in the resource XML.
The Compose version's analog to the Drawable is
the Hexagon Composable. It uses the same proportional spacing
for vertex calculations as HexagonDrawable, and integrates with Compose's
Shape mechanism, so it actually has several more visual options available than
the Drawable does at the moment. It has a @Composable content parameter as
well, so it actually substitutes for both the child View and its Drawable in the
other version.
The complete code is contained within the demo's examples subpackage,
grouped by two different formats: Shield and Grid.