Add line under tabs to ActionBar

After a lot of talking here and there, I am posting this issue I am facing. Basically I have a tabbed action bar. Below is a snapshot of what it looks like now:

enter image description here

And here is the piece of code that sets the tabs:

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
setTheme(R.style.Theme_example);

if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) {
    requestWindowFeature(Window.FEATURE_NO_TITLE);
}
setContentView(R.layout.landing_page);

ViewPager viewPager = (ViewPager) findViewById(R.LandingPage.pager);

final ActionBar bar = getSupportActionBar();

bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

mTabsAdapter = new LandingPageTabsAdapter(this, viewPager);
mTabsAdapter.addTab(bar.newTab().setText("Search"), Search.class, null);
mTabsAdapter.addTab(bar.newTab().setText("Categories"),Categories.class, null);
mTabsAdapter.addTab(bar.newTab().setText("Bookmarks"), Bookmarks.class,null);

} 

      

I want to add a straight line just below the tab label, which is the same color as the tab label. Something like the line in Google Playstore (green line round in red):

enter image description here

I am currently developing an action bar using Android Asset Studio ActionBar Style Generator . My only reason to put the line there is to get a clean look.

Can anyone suggest / advise how I can solve this? Thank you for stopping and sharing your thoughts.

+3


source to share


1 answer


Instead of adding a line below your action bar, try adding a line above your viewpager in your layout. Also play store doesn't use tabs they use PageTitleStrip



+5


source







All Articles