两个级别的Andr​​oid上的活动。无缝过渡 [英] Two levels of activities on Android. Seamless transition

查看:139
本文介绍了两个级别的Andr​​oid上的活动。无缝过渡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

该应用程序有3项活动:A,B和C
的B具有风格= Theme.Dialog,因此它可以被显示在上的A的顶部的屏幕的一小部分和C。
这样做是为了显示B之上,而A是越来越替换为C,因此A和C之间的过渡将出现无缝的用户。

问题

The app has 3 activities: A, B and C.
"B" has style=Theme.Dialog, so it can be displayed in a fraction of the screen on top of "A" and "C".
The idea is to show "B" on top while "A" is getting replaced with "C", so the transition between "A" and "C" will appear seamless for user.

Questions:

  1. 这是正确的做法(或者我应该使用,而不是活动的BPopupWindow等)?
  2. 在活动时C推出后,B是隐藏和重新显示(在onPause / onResume再次调用),这是寻找像B闪烁。有什么办法解决这一问题?

  1. 在初始状态。 A推出,B是A
  2. 顶部展开
  3. 在A结束后,B仍然是在顶部
  4. 在C推出,B眨了眨眼,带到前面(因为 launchMode =singleInstance
  1. initial state. "A" launched, "B" is launched on top of "A"
  2. "A" finished, "B" is still on top
  3. "C" launched, "B" blinked and brought to front (because of launchMode="singleInstance")

推荐答案

我不认为你能避免闪烁基于B效果时,A和B是2的活动。

I don't think you could avoid "blink" effect on B when A and B are 2 activities.

也许是一个解决方案,这将是合并A和C在同一活动。 管理一个国家知道,如果在状态A或C。

Perhaps a solution to that would be to merge A and C in same activity. Manage a state to know if new activity in in state A or C.

例如:

boolean stateA = ...;
if(stateA){
 setContentView(R.layout.a);
 //use code of A
 [...]
}else{
 setContentView(R.layout.b);
 //use code of B
 [...]
}

这似乎对我来说,更容易的解决方案。

It seems for me, the easier solution.

这篇关于两个级别的Andr​​oid上的活动。无缝过渡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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