Android - 对话框中的共享元素转换 [英] Android - Shared Element Transition In Dialog

查看:26
本文介绍了Android - 对话框中的共享元素转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有任何方法可以在活动/片段和对话框之间使用共享元素?

I wanted to know if there is any way to use shared elements between an activity/fragment and a dialog?

我有一个包含对话框的项目,我想在 Activity 的视图层次结构中的 ImageView 到我的 GalleryDialog 中的相关 ImageView 之间进行转换.

I have a project which contains dialogs and I want to make a transition between an ImageView in Activity's view hierarchy to the relevant ImageView in my GalleryDialog.

我搜索了一下,找到了这个链接:

I searched a bit and found this link:

与对话框活动共享元素转换

它描述了使用对话主题活动的工作流程.我想知道是否可以在不使用额外活动并将数据传递给该活动的情况下做到这一点.

which describes the workflow for using dialog themed activity. I was wondering if I could do it without using an extra activity and passing data with intent to that activity.

推荐答案

AFAIK 不可能在片段/活动和对话框之间使用共享元素.实现这一点的最佳方法是您提到的链接,使用看起来像对话框的以对话框为主题的活动,并通过意图向活动发送数据.

AFAIK its impossible to use shared elements between a fragment/activity and a dialog. The best way implement this is the link you mentioned, using a dialog-themed activity that looks like a dialog and send data via intent to the acctivity.

对于有意发送大数据,您可以使用 parcelables 或外部位置来存储数据,例如单例类或数据库.查看以下有关在活动之间传输大数据的答案:

For sending large data with intent, you can either use parcelables or an external place to store data, e.g. a singleton class or a database. Have a look at the following answer regarding transferring large data between activities:

Android - 在活动之间共享数据的最佳方式是什么?

这篇关于Android - 对话框中的共享元素转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆