Android 较低版本的浮动操作按钮
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24605116/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Floating Action Button for lower version
提问by user3487657
Is there a way I can Achieve the floating button to work on 4.0 and later android??
有没有办法可以实现浮动按钮在 4.0 及更高版本的 android 上工作?
I've seen it on google plus but I haven't found any tutorial. Only for android l preview. What did google+ use to achieve it?
我在 google plus 上看到过,但没有找到任何教程。仅适用于 android l 预览。google+ 用什么来实现它的?
回答by makovkastar
You can now use the FloatingActionButtonfrom the support-design library. Add this dependency to your gradle build file:
您现在可以使用support-design 库中的FloatingActionButton。将此依赖项添加到您的 gradle 构建文件中:
compile 'com.android.support:design:22.2.0'
And then add the FloatingActionButton to your layout file:
然后将 FloatingActionButton 添加到您的布局文件中:
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_margin="@dimen/fab_margin"
android:src="@drawable/ic_done" />
Example project from Chris Banes: https://github.com/chrisbanes/cheesesquare.
来自 Chris Banes 的示例项目:https: //github.com/chrisbanes/cheesesquare。
回答by makovkastar
I created an open-source library called FloatingActionButton. It's a Google+ like floating action button which reacts on the list view scrolling events. Becomes visible when the list view is scrolled up and invisible when scrolled down. API level 14+.
我创建了一个名为FloatingActionButton的开源库。这是一个类似于 Google+ 的浮动操作按钮,它对列表视图滚动事件做出反应。列表视图向上滚动时可见,向下滚动时不可见。API 级别 14+。
回答by Vladyslav Baidak
Here is one aditional free Floating Action Button library for AndroidIt has many customizations and requires SDK version 9 and higher
这是一个额外的免费Floating Action Button 库,适用于 Android它有许多自定义项,需要 SDK 版本 9 及更高版本
dependencies {
compile 'com.scalified:fab:1.1.2'
}
回答by Oleksii K.
Original post is here.
原帖在这里。
You can use this library, it works well from the Android 2.1, API level 7.
您可以使用这个库,它从 Android 2.1,API 级别 7 开始运行良好。
It's so easy to include it in your project:
将它包含在您的项目中非常容易:
build.gradle
构建.gradle
dependencies {
compile 'com.shamanland:fab:0.0.6'
}
layout.xml
布局文件
<com.shamanland.fab.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/your_image"
/>
回答by joselufo
You can use this demo FloatingView. This demo work from API 11.
您可以使用此演示FloatingView。这个演示工作来自 API 11。
Here put all the parts necessary to implement by code. FloatingView by steps
这里放了所有需要通过代码实现的部分。按步骤浮动视图
回答by Feay Jarana Manotumruksa
Try this library, https://github.com/navasmdc/MaterialDesignLibrary
试试这个库,https://github.com/navasmdc/MaterialDesignLibrary
It can be easily to adapt to your project using Android Studio
使用 Android Studio 可以轻松适应您的项目