There are a lot of sources and samples for both. I need a pager with dots as indicator and I m working with the new Studio on Android 5.0.
From a first look;
PagerSlidingTabStrip
looks newer and i managed to import it as a
gradle project and test.
ViewPagerIndicator
sample app on appstore might be removed. All
links in the posts seem to be broken. And I couldnT import as a
Gradle project either.
I was inclined to use the PagerSlidingTabStrip
but I am not sure if the pagination with small dots is easily configurable with the 'PagerSlidingTabStrip', as far as I understood, it s mostly designed for tabs with titles.
this is super simple to solve on your own here is a sample.
Add a LinearLayout(@+id/indContainer) below your ViewPager and then use this code to set the dots:
LinearLayout indContainer = (LinearLayout) findViewById(R.id.indicator_container);
for(int x=0;x<yourData.size();x++){
ImageView v = new ImageView(this);
int px = (int)(4 * (getResources().getDisplayMetrics().densityDpi / 160));
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayoutCompat.LayoutParams.WRAP_CONTENT, LinearLayoutCompat.LayoutParams.WRAP_CONTENT);
params.setMargins(px,0,px,0);
v.setLayoutParams(params);
v.setImageResource(R.drawable.indicator_inactive);
indContainer.addView(v);
}
then in your pageChangeListener:
LinearLayout indContainer = (LinearLayout) findViewById(R.id.indicator_container);
((ImageView) indContainer.getChildAt(position)).setImageResource(R.drawable.indicator_active);
((ImageView) indContainer.getChildAt(lastPage)).setImageResource(R.drawable.indicator_inactive);
lastPage = position;
Adjust as necessary for indicator icons and sizes