开发者

How to load Activity without animation (like tabs in TabHost load activities) on Android?

开发者 https://www.devze.com 2023-02-26 12:22 出处:网络
I\'ve set up a TabHost containing a TabWiget with three tabs in it - each of which loads a se开发者_开发百科parate activity. This all works well, switching between them is smooth, state drawables on t

I've set up a TabHost containing a TabWiget with three tabs in it - each of which loads a se开发者_开发百科parate activity. This all works well, switching between them is smooth, state drawables on tabs work well and so on.

However, in each activity (i.e. tab contents) I need to load further activities while still showing the tab bar at the top. Problem is, doing this:

startActivity(new Intent(this, SomeActivity.class);

loads the activity, but with a sliding animation. This looks weird when I'm supposed to have a fixed tab bar at the top (i.e. it slides out and back in). Switching activities with the tabs does not trigger this animation.

How can I load an activity without the sliding animation? I have no problem doing it through the TabHost if that's required, but its API didn't suggest this was possible.


Using ActivityGroup for the tab contents, and then managing their content with getLocalActivityManager seems to be the trick: http://blog.henriklarsentoft.com/2010/07/android-tabactivity-nested-activities/

0

精彩评论

暂无评论...
验证码 换一张
取 消