开发者

Android: How can I open up new activitys in the tab content, instead of full screen?

My Android app is created with a tab bar and the root activity is extending TabActivity. The problem I have is that I always want the tab bar to be visible.

Lets say that one of the activitys in one of the tabs have a button and when I tap that button I want to open up a new activity with the following code:

Intent intent = new Intent(this, MyActivity.class);
startActivity(intent);

The new activity opens up in full screen over the tab bar. I want it to show up in the FrameLayout where I have the tab content so that the tab bar is still visible. I want to use an activity so that I can use back stack etc. This must be standard in an app using a t开发者_开发技巧ab bar, so what am I doing wrong here?


I'm not sure but i think that if you want the activity to display within the tab content you should declare a tabspec, like for regular tabs, or directly set the TabHost current tab to the tab/activity you want to display?


To create a tabbed layout you should use a TabHost and a TabWidget as described here.


Seems like it is like Cristian says, there is no good way of doing this

From what I understand from that post there is a way but it is a "hack" and that Android isn't built to use this idea of an UI.

I have some questions about this, though:

So if my app is divided into five different large parts, that is perfect to divide into tabs (like I do on the iPhone). How would you solve this UI in Android in a good way without a tab bar? Or should I use a tab bar but open up new activitys full screen?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜