ongakuer / CircleIndicator

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

How can we set different widths for active and inactive dots #115

Closed harshitaahuja closed 5 years ago

harshitaahuja commented 6 years ago

ci_width is setting same width for all tabs. but in my case active tab has more width than inactive tabs as they have different drawables.

artemidius commented 6 years ago

In your project's res/anim/ folder create circleindicator_anim.xml file with following contents

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="@android:integer/config_shortAnimTime">
    <objectAnimator />
</set>

Then add app:ci_animator and app:ci_animator_reverse attributes to the tag like this

    <me.relex.circleindicator.CircleIndicator
        ...
        app:ci_animator="@anim/circleindicator_anim"
        app:ci_animator_reverse="@anim/circleindicator_anim"
       ...
     />

Library uses default animations, which makes empty items smaller. You define your own empty animation which solves a problem