ongakuer / CircleIndicator

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

Changing color of circle in programatically #160

Open vijayakumarksv opened 2 years ago

vijayakumarksv commented 2 years ago

How to change circle indicator color for programmatically?

CorzaHorizon commented 2 years ago

try this:

val indicator: CircleIndicator3 = binding.indicator
indicator.tintIndicator(mContext.getColor(R.color.red))

or

drawable > indicator_dot.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:padding="10dp"
    android:shape="oval">
    <solid android:color="@color/orange" />
    <corners
        android:radius="25dp" />
</shape>

layout file

<me.relex.circleindicator.CircleIndicator3
          android:id="@+id/indicator"
          android:layout_width="match_parent"
          android:layout_height="48dp"
          android:layout_marginBottom="10dp"
          android:layout_gravity="bottom"
          app:ci_drawable="@drawable/indicator_dot" />
thomas-warrier commented 2 years ago

@CorzaHorizon Thank you <3