简体   繁体   English

Gluon Mobile FloatingActionButton(FAB)动画

[英]Gluon Mobile FloatingActionButton (FAB) animation

I managed to get a second FAB on the left side of the view. 我设法在视图的左侧获得了第二个FAB。

commentFab.setFloatingActionButtonHandler(FloatingActionButton.BOTTOM_LEFT);

But it does so with an animation. 但这是通过动画实现的。 How can I remove the animation? 如何删除动画?

A FAB is intended for a primary action. FAB用于主要行动。 Material Design guidelines recommend just one FAB: 材料设计准则仅建议一种FAB:

Only one floating action button is recommended per screen to represent the most common action. 每个屏幕建议仅使用一个浮动操作按钮来代表最常见的操作。

and with animation: 并带有动画:

It animates onto the screen as an expanding piece of material, by default. 默认情况下,它作为扩展的材料动画到屏幕上。

Gluon's FloatingActionButton are designed with a translate animation when they are laid out after they are added to the View. 当将Gluon的FloatingActionButton添加到视图中后进行布局时,将使用平移动画进行设计。

To avoid that transition, you could play with the fab's visibility: set it to false, create an pause transition, add the fab to the layer, and set the fab's visibility to true when the pause transition ends. 为避免这种过渡,您可以使用fab的可见性:将其设置为false,创建暂停过渡,将fab添加到层中,并在暂停过渡结束时将fab的可见性设置为true。

In my opinion, you should use a different Layer implementation. 我认为,您应该使用不同的Layer实现。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM