android - 如何将我的 makeSceneTransitionAnimation 变成圆形而不是矩形?

标签 android android-5.0-lollipop activity-transition circularreveal

我目前正在尝试在我的 FAB 和另一个 Activity 之间创建一个循环过渡。

根据我在文档中的理解,我应该以与此类似的方式使用 makeSceneTransitionAnimation:

public void onFabClicked(View v){
    try {
        Intent intent = new Intent(this, SearchActivity.class);
        ActivityOptions options = ActivityOptions
                .makeSceneTransitionAnimation(this, v, "reveal");
        startActivity(intent, options.toBundle());
    } catch (Exception e) {
        // makeSceneTransitionAnimation not supported, maybe a check of SDK level is enough to avoid catching an error?
        Intent intent = new Intent(this, SearchActivity.class);
        startActivity(intent);
        e.printStackTrace();
    }
}

很遗憾,当前动画在播放过程中显示了一个矩形。

如何将它变成我们喜欢的 Lollipop 中美丽的圆形展示?

谢谢。

编辑:

我正在努力实现这一点(除了颜色应该是全屏的,但你明白了..)): enter image description here

我实际得到的:

enter image description here

最佳答案

好的,我以此为例:它工作正常:

Code on Github from saulmm

但是…… 是的,这很简单而且效果很好,但我想这并不是实现效果的最有效方法。 向您的布局添加额外 View 并玩弄可见性可能不是最佳方式。

实现起来有很多麻烦George Mount的解决方案。 但是由于这个解决方案是由谷歌的一名软件工程师编写的,在 Android UI 工具包团队工作,并由另一位谷歌工程师亚历克斯建议,我想我应该花更多的时间在它身上,因为它不需要额外的 View 在我的布局中...

第二个对我来说有点难,但会继续努力。

无论如何,问题都解决了。

关于android - 如何将我的 makeSceneTransitionAnimation 变成圆形而不是矩形?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28912805/

相关文章:

Android PreferenceFragment 从 Intent 获取结果

java - 如何通过应用程序更新设备上的 Android 操作系统

android - 下载 Android 源代码时出错

java - 使用自定义 View 中的共享元素启动 Activity

android - Lollipop 中的 Activity 和 Fragment 过渡

java - Dialog Fragment 在 MainActivity 中实现后抛出空指针异常

Android菜单项标题不显示

android - AlertDialog 按钮未包装在 Lollipop 中

android - 应用在某些版本的android手机中崩溃

android - 如何在 Android Lollipop 中推迟 Fragment 的进入转换?