ongakuer / CircleIndicator

A lightweight indicator like in nexus 5 launcher
Apache License 2.0
4.27k stars 714 forks source link

Changing circle indicator color #82

Closed krhckd93 closed 7 years ago

krhckd93 commented 7 years ago

Is it possible to change the color of the circles or the dots?

chihung93 commented 7 years ago

Just create an XML with your colors and use it with attrs : ci_drawable + ci_drawable_unselected


<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval">
    <solid
        android:color="@color/primary"/>
</shape>

app:ci_drawable="@drawable/circle_radius_selected"
 app:ci_drawable_unselected="@drawable/circle_radius_unselected"
tonroitman commented 7 years ago

Is there a way to change it programmatically?

chihung93 commented 7 years ago

@tonroitman : you can edit this lib, you should add method Get and Set for selectedIndicator/currentIndicator. create 2 drawable for selectedIndicator and currentIndicator, after that, you can set Background Drawable.

selectedIndicator.setBackgroundDrawable / selectedIndicator.setBackground currentIndicator.setBackgroundDrawable / currentIndicator.setBackground

Mariovc commented 7 years ago

Someone forked this lib to make this feature? I would like to change color dynamically (e.g. random color each second)

chihung93 commented 7 years ago

@Mariovc : Just do it yourself .

Mariovc commented 7 years ago

@chihung93 Thanks for your help! I just found someone who already did it.

deka91 commented 6 years ago

@Mariovc : can you send me the link for this?

Mariovc commented 6 years ago

https://github.com/ryanwr/CircleIndicator/commit/da4461bfc36d57ea705d1731b5aa5f475fc2f190

deka91 commented 6 years ago

@Mariovc : Thank you for your quick response!