This is an Android project allowing to animate a Floating Action Button menu with "lava" animation.
Just add LavaFab view in your layout XML and LavaFab library in your project via Gradle:
dependencies {
implementation 'com.bitvale:lavafab:1.0.1'
}
<com.bitvale.lavafab.LavaFab
android:id="@+id/lava_fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:lavaBackgroundColor="@color/color_pink"
app:lavaChild="left|top"
app:lavaParentSize="@dimen/fab_size"
app:lavaParentIcon="@drawable/ic_parent"
app:lavaLeftIcon="@drawable/ic_left"
app:lavaTopIcon="@drawable/ic_right"
app:lavaDrawShadow="true" />
You must use the following properties in your XML to change your LavaFab.
app:lavaBackgroundColor
(color) -> default ?attr/colorAccentapp:lavaParentSize
(dimension) -> default 56dpapp:lavaDrawShadow
(boolean) -> default falseapp:lavaChild
(flag) -> default left|topapp:lavaParentIcon
(drawable) -> default noneapp:lavaLeftIcon
(drawable) -> default noneapp:lavaLeftTopIcon
(drawable) -> default noneapp:lavaTopIcon
(drawable) -> default noneapp:lavaRightTopIcon
(drawable) -> default noneapp:lavaRightIcon
(drawable) -> default noneapp:lavaRightBottomIcon
(drawable) -> default noneapp:lavaBottomIcon
(drawable) -> default noneapp:lavaLeftBottomIcon
(drawable) -> default none
with(lava_fab) {
setLavaBackgroundResColor(R.color.fab_color)
setParentOnClickListener { lava_fab_center.trigger() }
setChildOnClickListener(Child.TOP) { lava_fab_center.collapse() }
setChildOnClickListener(Child.LEFT) { // some action }
enableShadow()
setParentIcon(R.drawable.ic_parent)
setChildIcon(Child.TOP, R.drawable.ic_child_top)
setChildIcon(Child.LEFT, R.drawable.ic_child_left)
}
LavaFab by Alexander Kolpakov is licensed under an Apache License 2.0.