我想创建一个类似 WhatsApp 附件功能的显示效果。在环顾四周以创建自定义内容时,我发现 Android 的android.support.design.circularreveal.cardview.CircularRevealCardView
视图已经可用,而无需添加任何外部库。
我这样实现了这个视图:-
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.circularreveal.cardview.CircularRevealCardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/ccv_attachment_reveal"
style="@style/style_mw"
android:elevation="@dimen/dimen_2dp"
android:orientation="vertical"
android:padding="@dimen/dimen_margin_16dp"
app:cardCornerRadius="@dimen/dimen_8dp"
>
<android.support.v7.widget.LinearLayoutCompat
style="@style/style_mw"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/rl_attachment_first_row"
style="@style/style_ww"
android:layout_marginStart="@dimen/dimen_30dp"
android:layout_marginTop="@dimen/dimen_margin_16dp"
android:layout_marginEnd="@dimen/dimen_30dp">
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab_add_gallery_image"
style="@style/style_ww"
android:layout_alignParentStart="true"
android:src="@drawable/ic_gallery_image"/>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab_add_camera_image"
style="@style/style_ww"
android:layout_centerHorizontal="true"
android:src="@drawable/ic_camera"/>
</RelativeLayout>
<RelativeLayout
style="@style/style_ww"
android:layout_marginStart="@dimen/dimen_30dp"
android:layout_marginTop="@dimen/dimen_margin_16dp"
android:layout_marginEnd="@dimen/dimen_30dp"
android:layout_marginBottom="@dimen/dimen_margin_16dp">
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab_add_gallery_image1"
style="@style/style_ww"
android:layout_alignParentStart="true"
android:src="@drawable/ic_gallery_image"/>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab_add_camera_image1"
style="@style/style_ww"
android:layout_centerHorizontal="true"
android:src="@drawable/ic_camera"/>
</RelativeLayout>
</android.support.v7.widget.LinearLayoutCompat>
</android.support.design.circularreveal.cardview.CircularRevealCardView>
这在我的应用程序上显示正常,就像常规 CardView 一样,我可以在单击按钮时将其设置为可见/不可见。但是,我在网上找不到任何实现,显示如何在使该视图可见的同时应用显示动画。是否有应用动画的内置功能,还是我必须自己创建一个?