Add a smooth sliding tab indicator to an Android app that uses ViewPager for swipeable sections.
Customize the tab strip appearance, indicator color, width, thickness, corner radius, directly in XML without extra Java code.
Supply fully custom views for each tab, such as icon-only tabs or tabs with notification badges.
Requires an existing Android project with ViewPager already set up.
Many Android apps display a row of tabs near the top of the screen, letting users swipe left and right between different sections. A small colored bar slides under the active tab to show which section you are on. Android has a built-in component for this called ViewPager, but the default tab strip it offers has limited visual feedback and customization options. SmartTabLayout is a Java library for Android that replaces that default tab strip with a more polished one. The main improvement is that the indicator bar moves continuously and smoothly as the user drags the screen between sections, rather than jumping from one position to another only after the swipe completes. This makes the navigation feel more responsive. The library offers a wide range of visual options you can set directly in your XML layout file without writing extra code: the color, width, thickness, and corner radius of the sliding indicator, whether it sits at the top or bottom of the tab strip, the color and thickness of divider lines between tabs, whether tabs share equal width, whether the active tab stays centered like in some Google apps, and the font size, color, and padding of the tab text. You can also supply a fully custom view for each tab if the built-in options are not enough. Setup involves adding the library as a dependency in your Android project's build file, placing the SmartTabLayout widget in your screen's XML layout above the ViewPager, and connecting the two with a single line of Java code. The README includes a demo app available on Google Play to preview the different visual styles before integrating. The library builds on an older Google sample project and adds additional features and configuration options. It supports both the newer AndroidX support libraries and older legacy support library versions of Android.
← ogaclejapan on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.