[英]How to create a submenu for Floating Action Button in Android Material Design?
[英]How to create floating action button transforming into a single sheet of material
我正在嘗試查看設計庫中是否存在任何內置動畫以創建浮動動作按鈕,該按鈕轉換為材料設計圖像中所示的單個材料表
您是否嘗試過https://github.com/gowong/material-sheet-fab ,它是Android武器庫的一部分?
從材質組件使用MaterialContainerTransform
:
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
}
有關更多詳細信息,請參閱文檔: https : //material.io/develop/android/theming/motion
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.