A lightweight paging indicator view for the ViewPager from the
Android Support Library.
This is an extremely lightweight implementation that displays the pages as horizontally aligned dots. If you need more control over the paging indicator's display checkout Jake Wharton's Android ViewPagerIndicator on which this implementation is based.
There is a sample app provided which demonstrates how to use the library.
Here are the steps required to add a ViewPagerIndicator to a ViewPager:
- Add
ViewPagerIndicatorto your view right below the respectiveViewPager:
<com.github.segoh.viewpagerindicator.ViewPagerIndicator
android:id="@+id/pager_indicator"
android:layout_height="wrap_content"
android:layout_width="match_parent" />- Bind the
ViewPagerIndicatorto yourViewPager:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Add an adapter to your pager
ViewPager pager = (ViewPager) findViewById(R.id.pager);
pager.setAdapter(new PageAdapter(getSupportFragmentManager()));
// Bind the pager indicator to your pager
ViewPagerIndicator pagerIndicator = (ViewPagerIndicator) findViewById(R.id.pager_indicator);
pagerIndicator.setViewPager(pager);
}Please note: If you require an OnPageChangeListener on your ViewPager set it
on the ViewPagerIndicator rather than on the ViewPager.
- Jake Wharton - Author of Android ViewPagerIndicator on which this lightweight ViewPagerIndicator implementation is based.
- Patrik Åkerfeldt - Author of ViewFlow, a precursor to the ViewPager, which supports paged views and is the original source of both the title and circle indicators.
- Francisco Figueiredo Jr. - Idea and first implementation for fragment support via ViewPager.
Copyright 2014 Sebastian Gutsfeld
Copyright 2012 Jake Wharton
Copyright 2011 Patrik Åkerfeldt
Copyright 2011 Francisco Figueiredo Jr.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
