我想做这个,但我没有找到任何 tuts 或任何如何制作它的东西。(它在谷歌网站上称为 Morph)有人可以告诉我如何或发送一些参考吗?
编辑:
我想将布局从消失设置为可见......你不知道我应该什么时候做 shape.setVisibility(View.VISIBLE) 吗?我试过了,但动画直到第二次点击按钮才会开始。(在第一次点击布局只是设置可见没有动画)
片段布局:
<EditText
android:id="@+id/editText"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusable="true"
android:gravity="top"
android:padding="15dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="@+id/circle"
android:visibility="gone">
</LinearLayout>
<ImageButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:background="@color/transparent"
android:contentDescription="share"
android:padding="15dp"
android:src="@drawable/ic_share_55x55px" />
分段:
ImageButton fab = (ImageButton) view.findViewById(R.id.share);
fab.setOnClickListener(new View.OnClickListener() {
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
public void onClick(View view) {
LinearLayout shape = (LinearLayout) getActivity().findViewById(R.id.circle);
// Create a reveal {@link Animator} that starts clipping the view from
// the top left corner until the whole view is covered.
Animator animator = ViewAnimationUtils.createCircularReveal(
shape,
shape.getWidth() - 130,
shape.getHeight()- 130,
0,
(float) Math.hypot(shape.getWidth(), shape.getHeight()));
// Set a natural ease-in/ease-out interpolator.
animator.setInterpolator(new AccelerateDecelerateInterpolator());
animator.setDuration(400);
// Finally start the animation
animator.start();
}
});