是否有在Android的材料设计的浮动操作按钮本地组件?组件、按钮、操作、材料

由网友(给不起的幸福)分享简介:我的问题围绕 浮动操作按钮 这是在Android的材料设计介绍。My question revolves around the Floating action button that was introduced in Android Material Design.有许多图书馆在GitHub上提供了该组件为:Th...

我的问题围绕 浮动操作按钮 这是在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的浮点操作按钮 FloatingActionButton CircularFloatingActionMenu 晶圆厂 浮动动作按钮 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
    }
});

更多信息这里。