A lightweight indicator like in nexus 5 launcher

Overview

CircleIndicator

A lightweight indicator like in nexus 5 launcher

Download

Maven Central

Gradle

AndroidX
dependencies {
    implementation 'me.relex:circleindicator:2.1.6'
}
Android Support Library
dependencies {
    implementation 'me.relex:circleindicator:1.3.2'
}

Usage

Class Widget
me.relex.circleindicator.CircleIndicator ViewPager
me.relex.circleindicator.CircleIndicator2 RecyclerView
me.relex.circleindicator.CircleIndicator3 ViewPager2 (AndroidX)
ViewPager (CircleIndicator)
ViewPager viewpager = (ViewPager) view.findViewById(R.id.viewpager);
viewpager.setAdapter(adapter);

CircleIndicator indicator = (CircleIndicator) view.findViewById(R.id.indicator);
indicator.setViewPager(viewpager);

// optional
adapter.registerDataSetObserver(indicator.getDataSetObserver());
RecyclerView (CircleIndicator2)
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);

// optional
adapter.registerAdapterDataObserver(indicator.getAdapterDataObserver());
ViewPager2 (CircleIndicator3)
ViewPager2 viewpager = view.findViewById(R.id.viewpager);
viewpager.setAdapter(mAdapter);

CircleIndicator3 indicator = view.findViewById(R.id.indicator);
indicator.setViewPager(viewpager);

// optional
adapter.registerAdapterDataObserver(indicator.getAdapterDataObserver());
Manual control
CircleIndicator indicator = view.findViewById(R.id.indicator);
indicator.createIndicators(5,0);

indicator.animatePageSelected(2)

XML Properties

<me.relex.circleindicator.CircleIndicator
	android:id="@+id/indicator"
	android:layout_width="match_parent"
	android:layout_height="48dp"/>
Properties Default Value
app:ci_width 5dp
app:ci_height 5dp
app:ci_margin 5dp
app:ci_drawable R.drawable.white_radius
app:ci_drawable_unselected R.drawable.white_radius
app:ci_animator R.animator.scale_with_alpha
app:ci_animator_reverse 0
app:ci_orientation horizontal
app:ci_gravity center
Comments
  • Dot not changing on page change

    Dot not changing on page change

    I'm fairly certain I've implemented everything as required, working off the sample with defaultIndicator. But when I change pages, the dots don't change along.

    I'm working within a Fragment, in onViewCreated:

    CircleIndicator pagerIndicator = (CircleIndicator) view.findViewById(R.id.pager_indicator); pagerIndicator.setViewPager(pager);

    I think that's all that is required besides the XML implementation in the view? Or am I missing something?

    opened by aeroperf 12
  • 发现内存泄露

    发现内存泄露

    在项目中LeakCanary检测了内存泄露 使用场景:CircleIndicator搭配ViewPager作为RecyclerView的一个Item

    • Retaining: 4.0 KB.
    • Reference Key: 355d4985-ef1f-4d93-a3ff-6d7cd0a8d2e1
    • Device: OnePlus ONEPLUS A0001 A0001
    • Android Version: 5.0.2 API: 21 LeakCanary: 1.4-beta1 02804f3
    • Durations: watch=5074ms, gc=208ms, heap dump=1507ms, analysis=35894ms

    In com.qingsongchou.social:1.0.3:1.

    • com.qingsongchou.social.ui.activity.project.detail.ProjectDetailSaleActivity has leaked:
    • GC ROOT android.view.Choreographer$FrameDisplayEventReceiver.this$0
    • references android.view.Choreographer.mCallbackQueues
    • references array android.view.Choreographer$CallbackQueue[].[1]
    • references android.view.Choreographer$CallbackQueue.mHead
    • references android.view.Choreographer$CallbackRecord.action
    • references android.animation.ValueAnimator$AnimationHandler.mAnimations
    • references java.util.ArrayList.array
    • references array java.lang.Object[].[0]
    • references android.animation.ObjectAnimator.mInterpolator
    • references me.relex.circleindicator.CircleIndicator$ReverseInterpolator.this$0
    • references me.relex.circleindicator.CircleIndicator.mContext
    • leaks com.qingsongchou.social.ui.activity.project.detail.ProjectDetailSaleActivity instance
    opened by doubleDragon 10
  • Bug - Unable To Import

    Bug - Unable To Import

    Hi, I've tried to import both of ur libs as dependencies. but non of them imported. I have this libs as my custom libs:

    compile 'com.android.support:appcompat-v7:21.0.3' compile 'com.nineoldandroids:library:2.4.0' compile 'com.daimajia.androidanimations:library:1.1.3@aar' compile 'com.joooonho:selectableroundedimageview:1.0.1'

    opened by TurKurT656 10
  • Add support for indicator click events.

    Add support for indicator click events.

    Hi,

    i needed the functionality to respond to click events on the indicators. Happy to adjust if this is not quite how you would have done it.

    Cheers Tobias

    opened by tobibo 9
  • Move away from jcenter since it'll be shutdown on May 1st 2021

    Move away from jcenter since it'll be shutdown on May 1st 2021

    https://jfrog.com/blog/into-the-sunset-bintray-jcenter-gocenter-and-chartcenter/

    This is unfortunate, but there's not much we can do other than moving away from it.

    opened by tfcporciuncula 8
  • Any idea why my selected indicator is wider than the other circles?

    Any idea why my selected indicator is wider than the other circles?

    This is my layout:

    <me.relex.circleindicator.CircleIndicator
               android:id="@+id/banner_indicator"
               android:layout_width="wrap_content"
               android:layout_height="6dp"
               app:ci_width="6dp"
               app:ci_height="6dp"
               app:ci_orientation="horizontal"
               android:layout_marginTop="4dp"
               app:layout_constraintLeft_toLeftOf="@+id/banner_pager"
               app:layout_constraintRight_toRightOf="@+id/banner_pager"
               app:layout_constraintTop_toBottomOf="@+id/banner_pager"/>
    

    And this is what it ends up looking like:

    image

    opened by casolorz 7
  • indicator不显示

    indicator不显示

    <me.relex.circleindicator.CircleIndicator
                android:id="@+id/yf_indicator"
                android:layout_width="match_parent"
                android:layout_height="40dp"
                android:layout_gravity="bottom" />
    
            <me.relex.circleindicator.CircleIndicator
                android:id="@+id/yf_indicator"
                android:layout_width="match_parent"
                android:layout_height="40dp"
                android:layout_gravity="bottom"
                app:ci_animator="@animator/indicator_no_animator"
                app:ci_drawable="@drawable/white_radius"
                app:ci_drawable_unselected="@drawable/yf_gray_radius" />
    

    这两种方式,indicator都不显示

    opened by amyliu1062 7
  • Notify Circle Indicator that Viewpager was changed

    Notify Circle Indicator that Viewpager was changed

    Is there any way to notify circle indicator when my view pager is changed? Example, when i initialize viewpager and circle indicator, my viewpager just contain 0 image, but at some reason i add it so my viewpager contain 3 image. And the result is no circle indicator cz when initialize my pager didnt have any image.

    opened by huzain07 6
  • Automatically slide to the next photo

    Automatically slide to the next photo

    Is there a way to make image gallery(Let's say three photos) automatically slide to the next one?

    From Photo#1 to Photo#2 after certain seconds, From Photo#2 to Photo#3 after certain seconds,

    And Photo#3 to Photo #1 after certain seconds, From Photo#1 to Photo #2 after certain seconds, ,,,, ,,,, infinite

    opened by kogisin 5
  • Selected dot with dynamic add/remove page

    Selected dot with dynamic add/remove page

    First of all, thank you for sharing your work, this material circle indicator is really quite cool ;)

    I would like to let you an issue about the selected state of the CircleIndicator with the use of a dynamic viewpager.

    Despite the fact that I have to call the setViewPager() method each time I notify my adapter that the data size has changed to avoid an exception, I also have another problem which can also be bypassed by another method call.

    Here is the concerned use of CircleIndicator :

    mPagerAdapter.add(object); // dynamic add of an object
    mPagerAdapter.notifyDataSetChanged(); // notify the data change
    mPagerIndicator.setViewPager(mImagesPager); // reset the viewpager to the indicator
    mViewPager.setCurrentItem(0, false); // set the current item to the first position
    mViewPager.setCurrentItem(mPagerAdapter.getCount()-1, false); // set the current item to the wanted position (the last added object)
    

    The question is : why do I set the item to the position 0 just before setting it to wanted position ? Because it permits me to avoid the following bug : the wanted position in a selected state AND also the first one. If I directly set the wanted position, I don't know why (for the moment, I will take time to read the CircleIndicator class) but the first indicator will always be selected.

    Thanks in advance for your answer !

    opened by HappyDr0id 5
  • Crashes when the ViewPager is empty

    Crashes when the ViewPager is empty

     java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.setBackgroundResource(int)' on a null object reference
                at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2411)
                at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2470)
                at android.app.ActivityThread.-wrap11(ActivityThread.java)
                at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1343)
                at android.os.Handler.dispatchMessage(Handler.java:102)
                at android.os.Looper.loop(Looper.java:148)
                at android.app.ActivityThread.main(ActivityThread.java:5401)
                at java.lang.reflect.Method.invoke(Native Method)
                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:725)
                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:615)
    
    opened by fahimk 5
  • Changing the size of the indicator icon

    Changing the size of the indicator icon

    I am used ViewPager2 and CircleIndicator 3 for my image slider but the size of the unselected and selected icons isn't equal.

    image

    This is my code:

    <me.relex.circleindicator.CircleIndicator3
            android:layout_width="match_parent"
            android:layout_height="30dp"
            android:layout_gravity="center"
            app:ci_drawable="@drawable/ic_indicator"
            app:ci_drawable_unselected="@drawable/ic_indicator_unselected"
            app:ci_height="8dp"
            app:ci_width="8dp"
            app:ci_margin="8dp"/>
    

    Anyone knows how to set size for the indicator icons? Any help will be appreciated. Thanks!

    opened by dukay159 2
  • Gradle Implementation of CircularIndicator not working in minSdk 23

    Gradle Implementation of CircularIndicator not working in minSdk 23

    I am trying to use Circular Indicator, so I wrote the dependencies as stated, implementation 'me.relex:cirleindicator:2.1.6'

    But when I am trying to sync and rebuild project, the android studio is throwing error:-

    `1: Task failed with an exception.

    • What went wrong: Execution failed for task ':app:checkDebugAarMetadata'.

    Could not resolve all files for configuration ':app:debugRuntimeClasspath'. Could not find me.relex:cirleindicator:2.1.6. Searched in the following locations: - https://dl.google.com/dl/android/maven2/me/relex/cirleindicator/2.1.6/cirleindicator-2.1.6.pom - https://repo.maven.apache.org/maven2/me/relex/cirleindicator/2.1.6/cirleindicator-2.1.6.pom Required by: project :app

    • Try:

    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. ==============================================================================

    2: Task failed with an exception.

    • What went wrong: Execution failed for task ':app:mergeDebugResources'.

    Could not resolve all files for configuration ':app:debugRuntimeClasspath'. Could not find me.relex:cirleindicator:2.1.6. Searched in the following locations: - https://dl.google.com/dl/android/maven2/me/relex/cirleindicator/2.1.6/cirleindicator-2.1.6.pom - https://repo.maven.apache.org/maven2/me/relex/cirleindicator/2.1.6/cirleindicator-2.1.6.pom Required by: project :app

    • Try:

    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. ==============================================================================

    3: Task failed with an exception.

    • What went wrong: Execution failed for task ':app:processDebugMainManifest'.

    Could not resolve all files for configuration ':app:debugRuntimeClasspath'. Could not find me.relex:cirleindicator:2.1.6. Searched in the following locations: - https://dl.google.com/dl/android/maven2/me/relex/cirleindicator/2.1.6/cirleindicator-2.1.6.pom - https://repo.maven.apache.org/maven2/me/relex/cirleindicator/2.1.6/cirleindicator-2.1.6.pom Required by: project :app

    • Try:

    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. ==============================================================================

    4: Task failed with an exception.

    • What went wrong: Execution failed for task ':app:mergeDebugAssets'.

    Could not resolve all files for configuration ':app:debugRuntimeClasspath'. Could not find me.relex:cirleindicator:2.1.6. Searched in the following locations: - https://dl.google.com/dl/android/maven2/me/relex/cirleindicator/2.1.6/cirleindicator-2.1.6.pom - https://repo.maven.apache.org/maven2/me/relex/cirleindicator/2.1.6/cirleindicator-2.1.6.pom Required by: project :app

    • Try:

    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. ==============================================================================

    5: Task failed with an exception.

    • What went wrong: Execution failed for task ':app:checkDebugDuplicateClasses'.

    Could not resolve all files for configuration ':app:debugRuntimeClasspath'. Could not find me.relex:cirleindicator:2.1.6. Searched in the following locations: - https://dl.google.com/dl/android/maven2/me/relex/cirleindicator/2.1.6/cirleindicator-2.1.6.pom - https://repo.maven.apache.org/maven2/me/relex/cirleindicator/2.1.6/cirleindicator-2.1.6.pom Required by: project :app

    • Try:

    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. ==============================================================================

    6: Task failed with an exception.

    • What went wrong: Execution failed for task ':app:desugarDebugFileDependencies'.

    Could not resolve all files for configuration ':app:debugRuntimeClasspath'. Could not find me.relex:cirleindicator:2.1.6. Searched in the following locations: - https://dl.google.com/dl/android/maven2/me/relex/cirleindicator/2.1.6/cirleindicator-2.1.6.pom - https://repo.maven.apache.org/maven2/me/relex/cirleindicator/2.1.6/cirleindicator-2.1.6.pom Required by: project :app

    • Try:

    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. ==============================================================================

    7: Task failed with an exception.

    • What went wrong: Execution failed for task ':app:mergeDebugNativeLibs'.

    Could not resolve all files for configuration ':app:debugRuntimeClasspath'. Could not find me.relex:cirleindicator:2.1.6. Searched in the following locations: - https://dl.google.com/dl/android/maven2/me/relex/cirleindicator/2.1.6/cirleindicator-2.1.6.pom - https://repo.maven.apache.org/maven2/me/relex/cirleindicator/2.1.6/cirleindicator-2.1.6.pom Required by: project :app

    • Try:

    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. ==============================================================================

    • Get more help at https://help.gradle.org

    BUILD FAILED in 2s`

    opened by TheTanmay1 0
  • There isn't any scroll if indicators count more then the screen able to fit

    There isn't any scroll if indicators count more then the screen able to fit

    For example. In my case, it can be 65+ items.

    The active indicator will not be shown until the half of items will be passed. Then it appears, passes the screen to the end, and disappears again

    opened by DanManDKo 0
  • Gone selected indicator

    Gone selected indicator

    Hi! I have 20 pages on a screen, I can show only 16 dots by the task of design. The current issue, when it starts, I can't see the selected dot -> when I swiped a couple of times my view pager if be more precise - swiped four times and saw selected indicator on the first display dot. When I swiped more than qty indicators display, the selected indicator is gone. Could you help me? How can I fix this situation?

    opened by AndryKorry 1
Releases(v2.1.6)
Owner
relex
relex
🦚 An expandable layout that shows a two-level layout with an indicator.

ExpandableLayout ?? An expandable layout that shows a two-level layout with an indicator. Including in your project Gradle Add below codes to your roo

Jaewoong Eum 716 Dec 25, 2022
A view pager indicator view to deal with a large amount of pages.

Attention I'm not going to support this anymore. Just use a better solution, e.g. this one Indefinite-Pager-Indicator BubblePagerIndicator A view page

Bogdan Kornev 134 Aug 18, 2022
Lightweight Android library for cool activity transition animations

Bungee min SDK 16 (Android Jellybean 4.1) written in Java A lightweight, easy-to-use Android library that provides awesome activity transition animati

Dean Spencer 172 Nov 18, 2022
You can easily access the top of the screen in Android. Like a iPhone 6 & 6 Plus.

Reachability on Android Easy access on top. Like a iPhone 6 & 6 Plus. demo apk Usage Add dependencies compile 'com.github.sakebook:Reachability:0.2.0@

sakebook 258 Nov 12, 2022
EtsyBlur is an Android library that allows developers to easily add a glass-like blur effect implemented in the Etsy app.

EtsyBlur EtsyBlur is an Android library that allows developers to easily add a glass-like blur effect implemented in the past Etsy app. Try out the sa

Manabu S. 755 Dec 29, 2022
A Photo Editor library with simple, easy support for image editing using paints,text,filters,emoji and Sticker like stories.

PhotoEditor A Photo Editor library with simple, easy support for image editing using Paints, Text, Filters, Emoji and Sticker like stories. Features D

Burhanuddin Rashid 3.6k Jan 9, 2023
💳 A quick and easy flip view through which you can create views with two sides like credit cards, poker cards etc.

The article on how this library was created is now published. You can read it on this link here. →. ?? EasyFlipView Built with ❤︎ by Wajahat Karim and

Wajahat Karim 1.3k Dec 14, 2022
Android library to display a few images in one ImageView like avatar of group chat. Made by Stfalcon

MultiImageView Library for display a few images in one MultiImageView like avatar of group chat Who we are Need iOS and Android apps, MVP development

Stfalcon LLC 468 Dec 9, 2022
Customizable bounce animation for any view like in Clash Royale app

Bounceview-Android Customizable bounce animation for any view updation Getting Started In your build.gradle dependencies { implementation 'hari.bo

Hariprasanth S 149 Nov 18, 2022
Navigation pattern like in Google News Stand app with transitions

Google-NewsStand-Animation-Android Navigation pattern like in Google News Stand app with transitions Getting Started In your build.gradle dependencies

Hariprasanth S 129 Nov 11, 2022
Android Library To Create Button With Multi Reactions like Facebook or Linkedin

ReactButton Android Library written in Java to Create ReactButton with Multi Reactions like Facebook or Linkedin ?? Default Reactions ?? Custom Reacti

Amr Hesham 103 Dec 15, 2022
FadeOutParticle is an animation for disappearing views like TextViews

FadeOutParticle is an animation for disappearing views like TextViews

Hooman Mohammadi 50 Dec 28, 2022
A Flutter plugin thats support share files to social media like TikTok, Instagram, Facebook, WhatsApp, Telegram and more others...

Social Share Kit A Flutter plugin that's support share files to social media like Tiktok, Instagram, Facebook, WhatsApp, Telegram and more. This plugi

Kaique Gazola 2 Sep 2, 2022
A lightweight indicator like in nexus 5 launcher

CircleIndicator A lightweight indicator like in nexus 5 launcher Gradle AndroidX dependencies { implementation 'me.relex:circleindicator:2.1.6' }

relex 4.1k Dec 30, 2022
Pixel Launcher Mods a root app for Android 12+ that enables you to add a number of features to the stock Pixel Launcher

A root app that enables you to add a number of features to the stock Pixel Launcher, without needing Xposed

Kieron Quinn 430 Jan 2, 2023
Gradle Plugin for publishing artifacts to Sonatype and Nexus

Introduction Due to Sonatype's strict validation rules, the publishing requirement must be satisfied by every artifact which wants to be published to

Johnson Lee 21 Oct 14, 2022
Step by step,just use HorizontalStepView,VerticalStepView. step indicator,flow indicator,timeline,order process,express status

StepView Step by step. Step indicator. Flow indicator。 snapshot like this:HorizontalStepView like this also like this:VerticalStepView Yeah,I am not w

baoyachi. Aka Rust Hairy crabs 4.1k Dec 30, 2022
A lightweight circular indicator view library for Android

A lightweight circular indicator view library for Android

İbrahim Süren 241 Dec 30, 2022
A spring indicator like Morning Routine guide.

SpringIndicator An indicator like Morning Routine guide.It was originally based on BezierDemo. The sample app: click me #Usage Add the dependency to y

null 2.4k Feb 21, 2022
Android-ScrollBarPanel allows to attach a View to a scroll indicator like it's done in Path 2.0

Path 2.0 like ScrollBarPanel for Android Android-ScrollBarPanel allows to attach a View to a scroll indicator like it's done in Path 2.0. Features Sup

Arnaud Vallat 551 Dec 22, 2022