A page indicator for DiscreteScrollView Android library
DiscreteScrollViewIndicator pageIndicator = DiscreteScrollViewIndicator.Builder(discreteScrollView);
discreteScrollView.addItemDecoration(pageIndicator);
float DP = Resources.getSystem().getDisplayMetrics().density;
DiscreteScrollViewIndicator pageIndicator = DiscreteScrollViewIndicator.Builder(discreteScrollView)
.setColorActive(getColor(R.color.ap_white))
.setColorInactive(getColor(R.color.pagerItem))
.setIndicatorStrokeWidth(4 * DP)
.setIndicatorItemPadding(10 * DP)
.align(DiscreteScrollViewIndicator.Alignment.PARENT_TOP)
.matchParentWidth();
discreteScrollView.addItemDecoration(pageIndicator);
The indicator automatically attempts to fetch the number of items through the adapter unless you set it manually as follows.
pageIndicator.setItemsCount(itemsCount);