Smooth transition between full-screen-activity and one with notification-bar and action bar

怎甘沉沦 提交于 2019-12-10 03:12:22

问题


Background

I have an app that has 2 activities :

  • splash activity, which is shown in full screen (no action bar, no notification bar)
  • main activity, which has both action bar (uses actionBarSherlock) and notification bar.

The problem

For some reason, when going from the first activity to the second, there is a "jumpy" layout process , which shows the content of the second activity without the action bar and notification bar, and a moment later it shows them both.

This causes the content below to move too, which is very noticeable.

Possible solution

As I've seen, a possible solution would be to hide the action bar and show it a bit later (500ms later), but this seems like a bad solution (making it slower and hiding for no reason) , plus i need to get the actionBar items positions for another purpose (for showing a tutorial).

The question

Is it possible to avoid the "jumpyness" ? One that doesn't involve such a weird workaround ?


回答1:


I've solved my problem doing the following:

1.- I have to optimize all the screens where the AB was shown. In some cases I used ListViews which weren't correctly implemented and that caused a noticeable load time in the activity.

2.- I have shown the status bar BEFORE starting the new activity. I mean: I've shown the status bar in the fullscreen activity just before starting the non-fullscreen one. With that I achieved that the layout of the second activity (non-fullscreen) was never resized.

With this two little changes now the AB transition is much more smoother.

You can find the complete post with my answer at: Smoother transition from fullscreen activity using ActionBarSherlock




回答2:


Why don't you use some other animation slide transitions rather than default popping one?

something like this?

overridePendingTransition(android.R.anim.accelerate_interpolator, android.R.anim.slide_out_right);

Here is the Animation lists that you can use http://developer.android.com/reference/android/R.anim.html



来源:https://stackoverflow.com/questions/20731429/smooth-transition-between-full-screen-activity-and-one-with-notification-bar-and

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!