Code Monkey home page Code Monkey logo

Comments (1)

GargoyleLizy avatar GargoyleLizy commented on August 15, 2024

Hi, I want to do the same thing - Changing the thumb during runtime.
So I looked at their code and find a way to do that.
The idea is simple, just copy their SeekArc as a base one and made modifications on it to get extra functions, then use the local new class as a replacement.
I do not know how to modify the library managed by gradle. So this is an alternative way from the stackoverflow.

Step 1, download the SeekArc.java from this repo and put it somewhere in your project. Now you have a local SeekArc class yourself and you can modify it then use it as custom view.
Step 2, insert the following code

    public void setmThumb(Drawable newThumb){
        mThumb = newThumb;
        int thumbHalfheight = (int) mThumb.getIntrinsicHeight() / 2;
        int thumbHalfWidth = (int) mThumb.getIntrinsicWidth() / 2;
        mThumb.setBounds(-thumbHalfWidth, -thumbHalfheight, thumbHalfWidth,
                thumbHalfheight);

        invalidate();
    }

And that is it.
You just need to replace the official SeekArc with your custom one and you could get/set the thumb.
I did not write the get method, but it is obvious as you can see from the set method.
PS : I did not test this method with different sizes of thumb, but it seems should work fine.

from seekarc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.