是否有在Android的材料设计的浮动操作按钮本地组件? [英] Is there a native component for the Floating action button in Android Material Design?
问题描述
我的问题围绕<一个旋转href="https://www.google.com/design/spec/components/buttons-floating-action-button.html#buttons-floating-action-button-floating-action-button"相对=nofollow> 浮动操作按钮 这是在Android的材料设计介绍。
My question revolves around the Floating action button that was introduced in Android Material Design.
有许多图书馆在GitHub上提供了该组件为:
There are many library offering this component on GitHub as:
- Android-floating-action-button
- FloatingActionButton
- CircularFloatingActionMenu
- Fab
- Floating-action-button
不过,我的问题是:
是否与 android.support.vX
的最后一个发行版是专为浮动操作按钮
?
Is there a native component with the last release of android.support.vX
that was built for Floating action button
?
如组件:
- android.support.v7.cardview
- android.support.v4.widget.DrawerLayout
- android.support.v7.widget.RecyclerView
- ...
推荐答案
今天(29/05/2015),它是正式缴费与新材料设计支持库。
Today (29/05/2015) it is officially avaiable with the new Material Design support Library.
就在这个依赖添加到您的 build.gradle
Just add this dependency to your build.gradle
compile 'com.android.support:design:22.2.0'
添加此视图布局:
<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:src="@drawable/ic_done" />
和使用它:
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//TODO
}
});
更多信息<一个href="http://developer.android.com/reference/android/support/design/widget/FloatingActionButton.html"相对=nofollow>这里。
这篇关于是否有在Android的材料设计的浮动操作按钮本地组件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!