I'm creating an app with Tab navigation. I display icons instead of text.
I want the tabs to only wrap the image, so I won't have to scroll to reach all the tabs.
How can I create tabs that just fills the screen?
This is how the tabs currently look:
You can see I need to scroll... There is another tab that is unseen in this screenshot.
This is my code for creating the tabs:
final ActionBar actionBar = getSupportActionBar();
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
// Create the adapter that will return a fragment for each of the three
actionBar.addTab(
actionBar.newTab()
.setIcon(R.drawable.tabs_bar_add_item)
.setContentDescription(TAB_ADD_ITEM)
.setTabListener(this)
.setCustomView(R.layout.add_item_tab)
);
actionBar.addTab(
actionBar.newTab()
.setIcon(R.drawable.tabs_bar_shopping_list)
.setContentDescription(TAB_SHOW_LIST)
.setTabListener(this)
);
actionBar.addTab(
actionBar.newTab()
.setIcon(R.drawable.tabs_bar_map)
.setContentDescription(TAB_SHOW_MAP)
.setTabListener(this)
);
actionBar.addTab(
actionBar.newTab()
.setIcon(R.drawable.tabs_bar_specials)
.setContentDescription(TAB_SHOW_SPECIALS)
.setTabListener(this)
);
The first R.layout.add_item_tab
is just a simple imageView. I tried it that way...
Any ideas?