Whats is the difference between actionbar and tabhost/tabactivity
Asked Answered
V

1

8

Quick question, Whats the difference between actionbar and tabhost. I used to use tabhost and add tabs to it.

Then I was asked to use actionbar and reading about it, it seems it is just another way of having tabs. So when would use each? Whats the difference

Thank you

Variety answered 7/10, 2012 at 19:46 Comment(0)
M
12

Pretty simple: ActionBar is the replacement of TabHost since Android 3.0.

Moreover, ActionBar can do more things than TabHost (like logo as a button, spinners, actions buttons…).

Have a look to ActionBar documentation on Android design guidelines.

Malek answered 7/10, 2012 at 19:57 Comment(5)
Another important thing is that ActionBar is based around the concepts of Fragments as opposed to Activities.Wail
@user210504: Not necessarily. Your tabs in the action bar can be tied to fragments, but they do not have to be. You can do whatever you want in your UI to affect a change based on a tab selection.Suzetta
@Suzetta I was trying to refer to your earlier comment in a pure holistic way : " If you think this will open up theNewActivity inside the tab, no, that will not work. You can certainly call startActivity() based upon a tab being clicked, but the UX probably is not what you want and even less likely to be what users want. "Wail
I'd like to know where's the source that said "ActionBar is the replacement of TabHost since Android 3.0". Thank you :)Solemnity
@yolapop Well, if we take TabHost by itself, it's not deprecated. But in this case, I assume that TabHost is a TabActivity which is deprecated now. Google recommends to use Fragments instead, so it makes more sense to use ActionBar instead of TabHost.Malek

© 2022 - 2024 — McMap. All rights reserved.