Inspired from Twitter iOS App and modified from CircleIndicator.
- Add the JitPack repository to your root build.gradle:
repositories {
maven { url "https://jitpack.io" }
}
- Add the dependency to your sub build.gradle:
dependencies {
compile 'com.github.nekocode:ToolbarIndicator:{latest-version}'
}
- Set the target ViewPager for ToolbarIndicator:
ToolbarIndicator toolbarIndicator = (ToolbarIndicator) this.findViewById(R.id.indicator);
toolbarIndicator.setViewPager(viewPager);
ToolbarIndicator get titles from FragmentPagerAdapter's getPageTitle function, check the sample project for more detail.