fab-transformation

介绍:

浮动操作按钮切换到菜单的两种效果。

运行效果:

使用说明:

build.gradle依赖

dependencies {
    compile 'konifar:fab-transformation:1.0.0'
}

布局

  1. 把Floating Action Button 与transform view放到布局中。

  2. 把 transform view包裹在Circular reveal 容器中。

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <!-- Any Fab is OK. (Third party library, your custom view and so on) -->
    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab"
        style="@style/FabMargin"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:src="@drawable/ic_share_white_24dp"
        app:backgroundTint="@color/blue_accent200"
        app:borderWidth="0dp" />
    <!-- You must wrap transform view in Circular reveal container -->
    <io.codetail.widget.RevealFrameLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true">
        <!-- Transform view -->
        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar_footer"
            android:layout_width="match_parent"
            android:layout_height="@dimen/footer"
            android:background="@color/blue_accent200"
            android:visibility="invisible">
            <!-- Put view you like -->
        </android.support.v7.widget.Toolbar>
    </io.codetail.widget.RevealFrameLayout>
</RelativeLayout>

Java

从fab过渡到其它view

abTransformation.with(fab)
                 .transformTo(toolbarFooter);

从其它view切换到fab

FabTransformation.with(fab)
                 .transformFrom(toolbarFooter);

选项

abTransformation.with(fab)
                 .overlay(overlayView)
                 .duration(500)
                 .setListener(new FabTransformation.OnTransformListener() {
                                @Override
                                public void onStartTransform() {
                                    // 
                                }
                                @Override
                                public void onEndTransform() {
                                    //
                                }
                 })
                 .transformFrom(toolbarFooter);

依赖的项目

已下载
0