在较低的空气污染安卓5活性转换空气污染、较低、活性

2023-09-03 21:54:41 作者:浪货界扛把子

每当我搜索我碰到这个机器人5(L)活性转换只适用于 API>。= 21

Every time i search i came across this " android 5(L) activity transition only available on API >= 21 .

这很好,但我可以看到像一些应用程序下载快谷歌收件箱使用类似的转变和也工作在较低的空气污染,所以这个应用程序可以怎么做这样的事?

that's fine but i can see some app like QuickPic and google inbox that use similar transition and also working on lower api, so how this app can do such a thing?

我做了什么?

1)很多搜索:)

2)玩 ActivityOptionsCompat 仅适用于API> = 21,这样的:

2) playing with ActivityOptionsCompat that only apply to api >= 21, like this:

ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(activity, transitionView, DATA.EXTRA_PASSED_JSON);
Intent intent = new Intent(activity, PhotoViewerActivity.class);
intent.putExtra(DATA.EXTRA_PASSED_JSON, json);
ActivityCompat.startActivity(activity, intent, options.toBundle());

编辑(问题标记为一式两份):这是从在这种情况下,其他问题不同,因为我说有其他的应用程序,这样做在较低的空气污染这一转变,我想知道他们是如何做到这一点

EDIT(question marked as duplicate): it's different from other question in this case, because i said there is other app that do this transition in lower api and i want to know how they do that.

推荐答案

我们加入了很多东西,在棒棒堂,使活动转换工作。它可以做手工活动转变(在早期版本),但你会遇到在某些情况下的问题和回报转变很可能将只在简单的情况下工作。切特·哈泽对这个一个devbyte这里。

We added a lot of stuff in Lollipop to make Activity Transitions work well. It is possible to do Activity Transitions manually (in earlier versions), but you will encounter problems in some cases and the return transition is likely going to work only in the simplest case. Chet Haase has a devbyte on this here.

动画片段之间是可能的更早,虽然API是不一样的棒棒堂的片段转变一样易于使用。

Animations between fragments were possible earlier, though the API isn't as easy to use as in Lollipop's Fragment Transitions.

我们想了很多回移植过渡到早期版本的支持库。仍然可能发生。如果是这样,我们也应该能够做一些对片段转换。

We thought a lot about back porting transitions to earlier versions in the support library. It may still happen. If so, we should also be able to do something for Fragment Transitions.