From 8080f2ebbffd35443a27b169c94e1ff4276c9fa7 Mon Sep 17 00:00:00 2001 From: relex Date: Sat, 13 Oct 2018 18:32:07 +0800 Subject: [PATCH] Update README.md --- README.md | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bfb12ea..ccd102d 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Gradle ###### AndroidX ```groovy dependencies { - implementation 'me.relex:circleindicator:2.0.0' + implementation 'me.relex:circleindicator:2.1.0' } ``` @@ -27,6 +27,9 @@ dependencies { Usage -------- + +###### ViewPager + ```xml +``` +```java +RecyclerView recyclerView = view.findViewById(R.id.recycler_view); +recyclerView.setLayoutManager(layoutManager); +recyclerView.setAdapter(adapter); + +PagerSnapHelper pagerSnapHelper = new PagerSnapHelper(); +pagerSnapHelper.attachToRecyclerView(recyclerView); + +CircleIndicator2 indicator = view.findViewById(R.id.indicator); +indicator.attachToRecyclerView(recyclerView, pagerSnapHelper); + +adapter.registerAdapterDataObserver(indicator.getAdapterDataObserver()); ``` ##### Properties: