问题标签 [floating-action-button]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
4 回答
6752 浏览

android - 浮动操作按钮出现在导航抽屉上

所以我使用https://github.com/neokree/MaterialNavigationDrawer作为我的导航抽屉和https://gist.github.com/Jogan/9def6110edf3247825c9作为我的 FAB 实现。当我打开导航抽屉时,它没有覆盖 FAB,并且按钮出现在它的顶部。我想避免隐藏按钮并在抽屉打开/关闭时显示它,因为这会分散注意力。有想法该怎么解决这个吗?

编辑:我正在以编程方式添加 FAB,执行以下操作:

将该声明更改为片段并不能修复它。我在上面链接的导航栏实现需要从 MaterialNavigationDrawer 类扩展的活动,该类可能首先绘制导航抽屉,而按钮始终位于最后。有没有办法以编程方式强制元素的排序?

0 投票
3 回答
555 浏览

android - FloatingActionButton 示例适用于 Android Studio,但不适用于 Eclipse

Eclipse-ADT 的老用户,我已经开始研究 Android Studio,因为网络上的大多数示例现在都是用 gradle 构建的。现在我刚刚在我的机器上安装了 Android Studio,并正在尝试来自 developer.android.com 的示例,特别是这个:FloatingActionButton

我在 Android Studio 中导入了项目,在我的 Nexus 5 上运行它,工作正常。FAB 是圆形的,并且有阴影等。

现在出于好奇,我尝试在 Eclipse 中构建相同的项目。所以我启动了 Eclipse,创建了一个新项目,将Application文件夹中的所有内容复制粘贴到正确的目的地,然后在同一设备上运行该项目。

按钮是方形的。

查看代码,以下几行负责将按钮设置为圆形,如下所示:

在 FloatingActionButton.java 下

现在的问题是,为什么这些代码片段可以在 Android Studio 上运行,但不能在 Eclipse 上运行?

0 投票
2 回答
2889 浏览

android - 膨胀类 FloatingActionButton 时出错

我使用https://github.com/makovkastar/FloatingActionButton

布局:

代码:

但是当我参加此活动时出现错误:

请告诉我,我做错了什么

应用程序编译没有错误

依赖项:

在此处输入图像描述 在此处输入图像描述

当我在 XML 中设置 attr 时:

错误:

但我导入了库

可观察滚动视图:

0 投票
5 回答
40738 浏览

android - 上下移动浮动操作按钮以避免被小吃店挡住

我正在使用这个库来实现一个浮动操作栏,当屏幕上出现一个快餐栏时,我似乎找不到移动按钮的方法。那个图书馆甚至有可能吗?

0 投票
4 回答
14707 浏览

android - 浮动操作按钮和白色背景

事实上,我正在寻找一种模仿 FAB 收件箱的方法。当用户按下红色按钮时,应该会出现一个 opac 视图和一个菜单。因为图片更有意义,看下图

在此处输入图像描述

我知道它存在这个很棒的库(https://github.com/futuresimple/android-floating-action-button)并且有了这个库,我可以显示浮动操作菜单。但我的问题是显示白色背景(不透明)。我没有找到解决我的问题的方法......

提前谢谢

0 投票
2 回答
2227 浏览

android - Android: Detail animation inside Floating Action Button

I am trying to get familiar with the new design guidelines of Android Lollipop. So especially for animations, I try to achieve something like these detailed animations for icons or buttons: http://www.google.com/design/spec/animation/delightful-details.html

I was wondering how they did that?

In my special case, I have a floating action button, which is used to drop an item in a shopping cart. After the user presses the button, I want to animate the icon drawable inside that button. The animation shall have a sliding effect where the cart is moved out to the bottom of the button and the check mark is moved in from the top of the button.

enter image description here enter image description here

I found a ViewFlipper (http://www.inter-fuser.com/2009/07/android-transistions-slide-in-and-slide.html), however I want to keep the button in place and only animate the icon inside the button.

On the other hand I found AnimationDrawables (http://developer.android.com/reference/android/graphics/drawable/AnimationDrawable.html) but there, I have to create each frame by hand, which is also odd.

What's the best way to achieve that?

0 投票
1 回答
2041 浏览

android - 如何将浮动操作按钮添加到 ViewPager 的所有页面

我正在开发一个应用程序,其中主要活动由 SwipeView 布局组成。

该活动由 2000 多个页面组成,这些页面由文本单独填充,这些文本采用简短的事实形式。

我想向那些页面添加一个浮动操作按钮,单击该按钮时会将 FACT 标记为收藏,用户可以稍后查看。

我怎样才能实现它而不必单独向所有页面添加一个按钮(这将是不切实际和荒谬的)。

0 投票
1 回答
1577 浏览

android - 2个或更多浮动操作按钮之间的距离是多少?

我在我的应用程序中添加了 2 个 FAB(如 Google Maps 应用程序,请参见下面的屏幕截图),我想知道 2 个 FAB 之间是否存在特定距离(来自 Google 设计模式、文档、圣经或其他),或者是否决定这些按钮之间的距离的是开发人员。

在此处输入图像描述

0 投票
4 回答
27842 浏览

android - 如何在滚动视图顶部添加浮动操作按钮

我有一个浮动操作按钮,我想将它添加到滚动视图的顶部,以便按钮保持不变,即使您滚动也是如此。我希望它在滚动视图的顶部和屏幕的右下角。我需要使用哪些视图组合来完成此操作?

这是xml文件:

0 投票
2 回答
1509 浏览

android - Drag shadow is square for a round floating action button

I am on Android Lollipop (minSdk=21), and want to implement moving a Floating Action Button around with a dragging gesture. The button is a custom subclass of ImageButton, the code is described here so I won't repeat it: Define default values for layout_width and layout_height properties for a subclass in a style

For dragging, I use the way described here: http://developer.android.com/guide/topics/ui/drag-drop.html. Here is what my code looks like:

Generally, it works, but the problem is the 'drag shadow': it is square. For this reason or the other, it doesn't respect the oval outline of the FAB.

How can I make it behave correctly?