Igor
Igor

Reputation: 205

Seek Bar dynamically

I am using a SeekArc library that is a circular seek for Android. I have the xml and inside it I can set the max value of the SeekBar (seek arc:max="150"). But I want to change it dynamically and if I do SeekBar.setMax does not work. Is there some other possibility to change the max value dynamically? Here is my code.

Thank you

<com.triggertrap.seekarc.SeekArc
            android:id="@+id/seekArc"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:padding="30dp"
            seekarc:arcColor="#C0C0C0"
            seekarc:clockwise="true"
            seekarc:max="150"
            seekarc:progressColor="@color/red"
            seekarc:rotation="180"
            seekarc:startAngle="30"
            seekarc:sweepAngle="300"
            seekarc:thumb="@drawable/custom_seek_arc_control_selector"
            seekarc:touchInside="true" />

Upvotes: 0

Views: 992

Answers (1)

adneal
adneal

Reputation: 30804

It doesn't looks like the library has a way to dynamically set the maximum value, but you could easily modify the SeekArc class to include one. Maybe even fork it and submit a pull request.

public void setMax(int max) {
    mMax = max;
    invalidate();
}

Upvotes: 1

Related Questions