0

I am stuck with creating a simple design using Tabs widget in Android.

Please help me to create a similar design.

enter image description here

Just note that , the bottom border is not at the bottom of the box and also its width is much less than the width of the box.

BeingExpert
  • 523
  • 1
  • 5
  • 16

1 Answers1

0

If you are using TabLayout then you can use setCustomView to set custom tab.

    TabLayout tabLayout = (TabLayout) findViewById(R.id.sliding_tabs);
    tabLayout.setupWithViewPager(viewPager);

    // Iterate over all tabs and set the custom view
    for (int i = 0; i < tabLayout.getTabCount(); i++) {
        TabLayout.Tab tab = tabLayout.getTabAt(i);
        tab.setCustomView(pagerAdapter.getTabView(i));
    }

Checkout here for full example

Priyank Patel
  • 12,244
  • 8
  • 65
  • 85
  • Still question is , will it behave like tabs , when adding custom view , like when i click on "family" tab , the border should slide down below family. Can i be able to maintain that sliding effect. – BeingExpert Nov 29 '16 at 11:11