I am using tabs in my application.
I have 3 tabs : home, services, contact us.
In the 'home tab', there is 'login button' and my requirement is when I click the login button, it should display the view for 'login' in the same tab itself. That means it should start another activity (login.class) and display corresponding view (login.xml). And the tabs should be displayed at the top as before.
But when I click the login button, 开发者_如何学编程it should start login activity, but the tabs are disappeared.
How can I start an activity in the same tab itself?
In that case you may need to use ActivityGroup
(it's pain in the ass I have to say):
Use Android ActivityGroup within TabHost to show different Activity
There are more examples about it, just Google them.
I have no experience with the TabHost, because I didn't used it by now, but what I found could be interesting for you:
http://developer.android.com/resources/tutorials/views/hello-tabwidget.html
There they are using
spec = tabHost.newTabSpec("albums").setIndicator("Albums",
res.getDrawable(R.drawable.ic_tab_albums))
.setContent(intent);
So what you can use is calling an Intent on an existing Activity when user logged in and use
public TabHost.TabSpec setContent (Intent intent)
This sounds feasible to to me.
精彩评论