有没有办法我可以实现浮动按钮工作4.0和更高版本的
android?
我已经在谷歌加了,但我还没有找到任何教程.只为Android l预览.谷歌用来做什么?
解决方法
您现在可以使用支持设计库中的
FloatingActionButton.将此依赖关系添加到您的gradle构建文件中:
compile 'com.android.support:design:22.2.0'
然后将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" />
Chris Banes的示例项目:https://github.com/chrisbanes/cheesesquare.