Skip to content Skip to sidebar Skip to footer

Get Onscreen Position Of Current Seekbar Progress/secondary Progress?

I'm trying to customize the look of a seekbar by overriding the onDraw() method - I need to find the current progress/secondary progress position on screen. I know how to get the c

Solution 1:

I got around this by setting the max progress to the width of the screen:

    WindowManager wm = (WindowManager) myAppContext.getSystemService(Context.WINDOW_SERVICE);
    Display display = wm.getDefaultDisplay();
    Point size = new Point();
    try{
        display.getSize(size);//only works on later versions of android
    }
    catch (Exception e) {

        int width = display.getWidth();  // deprecated
        int height = display.getHeight();  // deprecated
        size = new Point(width, height);
    }
myProgressBar.setMax(size.x);

Post a Comment for "Get Onscreen Position Of Current Seekbar Progress/secondary Progress?"