I'm trying to see if any in-build animation exist on the design library to create floating action button transforming into single material sheet like shown in the material design image
https://material-design.storage.googleapis.com/publish/material_v_4/material_ext_publish/0B8v7jImPsDi-TjBicTdvQjg4M1E/components-buttons-fab-transition_card_02.webm
Add the floating action button to your layoutThe size of the FAB, using the app:fabSize attribute or the setSize() method. The ripple color of the FAB, using the app:rippleColor attribute or the setRippleColor() method. The FAB icon, using the android:src attribute or the setImageDrawable() method.
Designing Custom Expandable FAB After creating a new Android project, go to the drawable folder and import drawable icons from vector assets. These icons will be placed at the center of the FAB. To add icons, right-click on drawable , select new , then select Vector Asset and choose an icon from Clip Art .
Use MaterialContainerTransform
from Material Components:
private fun toggleFabMenu() {
val views = listOf<View>(fab, menuView).sortedBy { !it.isVisible }
val shareMenuTransform = MaterialContainerTransform().apply {
startView = views.first()
endView = views.last()
scrimColor = Color.TRANSPARENT
duration = 500
}
TransitionManager.beginDelayedTransition(root, shareMenuTransform)
views.first().isVisible = false
views.last().isVisible = true
}
See docs for more details: https://material.io/develop/android/theming/motion
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With