简体   繁体   English

Android-当最小SDK为16时,对活动B中的活动A的视图进行动画处理

[英]Android - Animate views from Activity A in Activity B when minimum SDK is 16

Making a project I am faced with the following problem. 进行项目我面临以下问题。

I have to perform some animations on views that belong to Activity A while at the same time perform animations that belong to Activity B. 我必须在属于活动A的视图上执行一些动画,同时执行属于活动B的动画。

Minimum SDK is 16 so I cannot use the Shared Elements approach. 最低SDK为16,所以我不能使用共享元素方法。

The best approach I can think of is to start Activity B WITHOUT ANIMATION and create a mechanism that passes from Activity A to activity B instructions to create the necessary views dynamically, add them to the parent layout and perform the desired animations on all views. 我能想到的最好的方法是启动没有动画的活动B,并创建一种从活动A传递到活动B指令的机制,以动态创建必要的视图,将它们添加到父布局中,并在所有视图上执行所需的动画。

Could someone share some insight about how to do something like that? 有人可以分享一些有关如何做这样的事情的见解吗? My first thought was to pass a list of the InstanceState bundles for each view. 我的第一个想法是为每个视图传递InstanceState捆绑包的列表。 something like 就像是

for(ViewReplicationData data:viewReplicationData){
    if(data.getViewClassName().equals("TextView"){
        TextView tv = new TextView(this);
        rootLayout.addView(tv);
        tv.onRestoreInstanceState(data.getInstanceState());
    }
}

Since everyone is providing solutions that work only for ImageViews let me be clear...I m talking about animating whole layouts that have TextViews, Buttons, ImageViews, ToggleButtons, CheckBoxes..everything. 由于每个人都提供仅适用于ImageViews的解决方案,因此请让我清楚...我在说的是对具有TextViews,Buttons,ImageViews,ToggleButtons,CheckBoxes..everything的整个布局进行动画处理。

Hope this is what you are looking for 希望这是您要寻找的

https://github.com/lgvalle/Material-Animations https://github.com/lgvalle/Material-Animations

Thanks. 谢谢。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM