Reputation: 179
I want to create a simple application where I can
On one hand, it seems that the most modern way to do this, for now, is using Action Bar:
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
But it seems to me that it is not possible to do both using the tabs from the action bar.
To perform the two things I want, do I have to use TabHost, with fragments (the older way) or can I use the action bar tabs with fragments?
Upvotes: 2
Views: 2762
Reputation: 3847
I use ActionBar tabs in my application, and I customize their look via android stles/themes.
In the theme:
<style name="AppBaseTheme.Light" parent="android:Theme.Holo.Light.DarkActionBar">
...
<item name="android:actionBarTabStyle">@style/MyTabView</item>
...
</style>
Then I define a style:
<style parent="@android:style/Widget.Holo.ActionBar.TabView" name="MyTabView">
<item name="android:background">@drawable/tab_bg</item>
</style>
Your 'drawable' can be a 9-patch, layer-list, selector, image, etc.
Upvotes: 2