0

我的应用中有一个没有任何标签的主屏幕。它只有一系列按钮。单击按钮会启动顶部包含选项卡栏的新活动。这个功能正常。我可以很好地单击所有选项卡。不过,我想做的是添加另一个实际上没有内容的选项卡,而是在单击时将用户带回主屏幕。这是可能的,如果是这样,我将如何去做?

4

1 回答 1

0

What about just closing the "tabbar at the top"- Activity with finish(). Your homescreen is right under if you did not finish() it. This is IMHO the most basic way to navigate in Android.

Another way is from your "tabbar at the top"- Activity you could do this

Intent intent = new Intent(this,homescreen.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);

This should kill your "tabbar at the top"- Activity and start homescreen activity if it's not started. If it's started it will pop up

Check this How do you use Intent.FLAG_ACTIVITY_CLEAR_TOP

于 2013-10-11T19:21:32.420 回答