Skip to content

Guide · Open source

How to use FlycoTabLayout: add tab bars to an Android app

Updated · written with AI from the project's own documentation and checked against our catalogue data

FlycoTabLayout is an open-source Java library for Android apps that provides tab bars, the row of tabs used to switch between screens or pages. This guide explains how to add it to an AndroidX project with Gradle, how to choose between its three tab types, and which attributes control indicators, text, icons and unread-message tips. By the end you will know where to start and which parts of the README to check next.

FlycoTabLayoutH07000223/FlycoTabLayout · ★ 11.1k · MIT

Quick start

  1. 1Confirm prerequisites. Check that you have Android Studio with Gradle and an Android project that uses AndroidX.
  2. 2Add the dependency. Add implementation 'io.github.h07000223:flycoTabLayout:3.0.0' to your build.gradle dependencies block.
  3. 3Pick a tab type. Use SlidingTabLayout with ViewPager for a sliding strip, or CommonTabLayout if you need tabs that work without ViewPager.
  4. 4Add the tab layout to your screen. Place the tab view in your layout file and connect it to your pages using setViewPager or setTabData.
  5. 5Style the tabs. Set tl_ attributes such as indicator color, text colors and icon settings, noting which ones apply to your tab type.
  6. 6Test with your data. Run the app and check the indicator, text and any unread-message tips on a device or emulator.

What FlycoTabLayout is and when to use it

FlycoTabLayout is a library for Android apps. It gives you a ready-made tab bar, so you do not have to build one from scratch. The README describes three kinds of tab layout: SlidingTabLayout, CommonTabLayout and SegmentTabLayout.

  • Use it if you are an Android developer who wants a styled tab bar.
  • Use SlidingTabLayout if your app already uses ViewPager and you want a sliding tab strip with indicators.
  • Use CommonTabLayout if you need tabs that work without ViewPager.
  • Use it if you need tabs with icons or unread-message badges.
  • Do not use it for Jetpack Compose projects, iOS or web projects. The README describes only Android View-based widgets and mentions no Compose support.

Add FlycoTabLayout to your Android project with Gradle

The prerequisites are Android Studio with Gradle and an Android project that uses AndroidX. Add the dependency to your build.gradle file. The version shown here is the one in the README for the AndroidX build.

If your project still uses the old support libraries, the README lists a legacy set of dependencies instead. Use the AndroidX line for new projects.

implementation 'io.github.h07000223:flycoTabLayout:3.0.0'

Choose the right tab type: SlidingTabLayout or CommonTabLayout

SlidingTabLayout is deeply modified from PagerSlidingTabStrip and is tied to ViewPager. It has a setViewPager method that accepts a list of titles. A second overload also accepts a FragmentActivity and a list of fragments, so you do not need to set up the adapter yourself.

CommonTabLayout does not depend on ViewPager, so you can use it with other widgets. Its setTabData method takes a list of CustomTabEntity objects, a FragmentManager, a container view ID and a list of fragments, and it switches the fragments itself. SegmentTabLayout is also included, but the README gives no usage details for it.

public void setViewPager(ViewPager vp, String[] titles) public void setTabData(ArrayList<CustomTabEntity> tabEntitys, FragmentManager fm, int containerViewId, ArrayList<Fragment> fragments)

Style indicators, text, icons and unread tips with attributes

Both layouts are styled with XML attributes that start with tl_. The README lists them in a table. Some apply only to one tab type, and the table marks those cases. Check the table before you assume an attribute works everywhere.

  • Indicator: tl_indicator_color, tl_indicator_height, tl_indicator_width, tl_indicator_corner_radius, tl_indicator_gravity and tl_indicator_style (NORMAL, TRIANGLE or BLOCK).
  • Text: tl_textsize, tl_textSelectColor, tl_textUnselectColor and tl_textBold.
  • Tab spacing: tl_tab_padding, tl_tab_space_equal and tl_tab_width.
  • Icons (CommonTabLayout only): tl_iconWidth, tl_iconHeight, tl_iconVisible, tl_iconGravity and tl_iconMargin.
  • Indicator animation (CommonTabLayout only): tl_indicator_anim_enable, tl_indicator_anim_duration and tl_indicator_bounce_enable.
  • tl_indicator_width_equal_title applies only to SlidingTabLayout.

Check the demo and the README before you build

The README includes three preview GIFs that show the tab types in use. Look at them to see the styles before you choose. The project also lists two dependencies, NineOldAndroids and FlycoRoundView, which you should expect to be part of the build.

What people use it for

  • Adding a sliding tab strip with indicators to an app that already uses ViewPager.
  • Building a tab bar with icons where each tab has its own entry object.
  • Showing unread-message tips on tabs in a messaging or notification screen.
  • Creating tabs that switch fragments without a ViewPager.

Frequently asked questions

How do I install FlycoTabLayout?

Add implementation 'io.github.h07000223:flycoTabLayout:3.0.0' to the dependencies block in your build.gradle file. The README says this is the AndroidX version and it is published on Maven Central.

Is FlycoTabLayout free to use?

Yes. The project is licensed under the MIT License, which allows use in other projects. Read the license text in the repository for the full terms.

Does FlycoTabLayout work with Jetpack Compose?

The README describes only Android View-based widgets and does not mention Compose. Do not assume it works in a Compose project without checking the source yourself.

What is the difference between SlidingTabLayout and CommonTabLayout?

SlidingTabLayout depends on ViewPager and is based on PagerSlidingTabStrip. CommonTabLayout does not depend on ViewPager and can be used with other widgets.

Does FlycoTabLayout support icons and unread-message badges?

Yes. The README says CommonTabLayout supports icons with icon gravity and unread-message tips. Icon attributes are marked as CommonTabLayout only.

What are the alternatives to FlycoTabLayout?

The README names PagerSlidingTabStrip, Material Components TabLayout and SmartTabLayout as comparable projects. The README does not compare them with FlycoTabLayout, so check each one's features yourself.

New agent skills, repos and AI tools — every week

The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.

Our verdict

FlycoTabLayout suits Android developers on View-based apps who want a styled tab bar with indicators, icons and unread tips without building one from scratch. Teams building with Jetpack Compose, non-Android projects or those who need the newest Material tab components should pick a different option. The README's last push was in May 2023, so check the repository's current state before you rely on it.

Install options & downloads