Seekbar set thumb with secondprogress - android

Refferance Changing Android SeekBar to draw secondary progress on top of primary progress?
I want to make a seekbar that has thumb independent from progress or add a thumb to a progressbar so I can work independently with progress/secondaryProgress/thumb.
Ideally I would like to set secondaryProgress via dragging thumb.
I looked trough the source code of SeekBar, AbsSeekBar and ProgressBarr. The code is very ambiguous and a lot of methods can't be overriden.
I'm looking forward to making a draggable thumb that sets scondaryProgress, and on release, the progress starts rising to reach the level of the thumb.

https://code.google.com/p/regie-eclairage-saint-michel
Use this project that has a vertical seekbar based on the original source code.
It contains source code for VerticalProgressBar, VerticalAbsSeekBar, VerticalSeekbar exactly as the original,just verical.

Related

How to have numbered scale with Seekbar (Android)?

I am trying to customise Seekbar. I need Seekbar like :
How do I add numbered scale to Seekbar as shown in image above?
I have been able to make custom thumb and custom progress drawable simply by using their vectors, in XML, as:
android:thumb="#drawable/custom_seekbar_thumb"
android:progressDrawable="#drawable/custom_seekbar_progress"
android:splitTrack="false"
But I have not been able to use the numbered scale as shown in the image.
Some answers on stack overflow say about how to draw numbers above/below Seekbar, but I couldn't find any information on how to draw the vertical line (|) below each number.
Any help would be appreciated. Thanks!
There is a method setTickMark and xml attribute android:tickMark that can be used to draw vertical lines. But there are two problems. The first one is it is only available in api 24+. The second one is that all the ticks would be the same and in your design they are different.
Unless you find a library that does exactly what you need, your best option is to create a custom view by subclassing/copying SeekBar and customizing the onDraw method.

Android - Seekbar - Customize seekbar UI

Recently, I've been working with seekbar. I want to create seekbar have a small gap between thumb and progress bar like in the picture I attached. Can anyone help me or tell me how I can do. Thanks
Seekbar sample
I think your thumb image have some spacing so this is happend.
I solved this problem by very simple, like Brahgrav said, just redraw the thumb with spaced outside and set to android:thumb. I will attach a thumb image for you to see.
Thumb image

SeekBar add padding to only the thumb

I have a SeekBar that I'm trying to implement custom styling on. The edges of my progressDrawable have rounded corners which I think looks great, however when i drag the thumb to the edges it looks strange.
This is how the SeekBar looks when I use an "in the middle" progress value like 80.
And this is how the start and end look when I use a progress value of 0 or 100 respectively. You can see how the rounded corners look strange due to the way the thumb goes all the way to the end of the SeekBar.
I'm looking for a way to get the thumb to STOP at around 16dp before the end of the SeekBar, but for the progressDrawable to still fill it in as if it had gone to 100.
I also just noticed that the thumb seems to cut off half way through it's drawable. That is not related to what I'm asking, so I'm trying to avoid any confusion there.

Setting progress drawable on Seekbar causes thumb to overflow

I have a problem with seekbars. They work without issues until I try and do the following:
seekBar.setProgressDrawable(getResources().getDrawable(R.drawable.seek_bar));
I even tried using a color only instead of a drawable resource. Same issue. The problem is when I do set the drawable, I see that the Seekbar drawable is a bit shorter (from start and end) and the thumb icon can go beyond it.
Also, I have noticed that the thumb icon itself has a white background surrounding it (not transparent). I even tried setting a vector drawable for the thumb, and the thumb went beyond the boundaries of seekbar (part of the thumb was hidden).
Could someone explain this behavior. I have tried searching for around three hours now without luck. I even tried the solution from:
How to set Android SeekBar progress drawable programatically
Which has the same issue for me.
Thank you.
To get rid of the non-transparent background I have used:
seekBar.setSplitTrack(false);
To make the thumb not go beyond the boundaries, I have shrunk the thumb. It is not perfect but it works.

Is it possible to have a SeekBar's thumb image extend outside the bar?

I have set negative paddings on my custom seekbar so that the round thumb image can go outside the bar, but the thumb isn't rendered out there, is there anyway to force the thumb to be drawn outside those bounds?
Sorry guys, I'm new to Android development, and have been tasked with fixing an existing application. The problem is that we have a custom rounded looking track bar, which consists of two rounded 'end cap' images and a 1 px background that is tiled to create the seekbar. As far as I can tell there was never one image that could be set as the background of a normal SeekBar, which is why a custom one was created.
The thumb is a circle and needs to 'fit' into the end caps - the three pieces of the bar are in a relative layout. Right now I'm kind of unclear as to how the 1 px background png gets stretched as the seekbar bg, otherwise I would try to tack on the two endcaps onto that drawable some how ... ?
Please let me know if this was unclear and I'll try to post any followup info. Thanks in advance for any advice!!
Oh, I'm using Android 2.1 if that's relevant to anyone's interests :)
This is what it looks like when the thumb all the way over - outside of the seekbar. Ideally what I need is for the thumb to be shown as 'inside' the endcap image :-/
I was having the same problem, my thumb is very big length wise and it kept being cut off. Make sure that you set the offset property AFTER you set the drawable for your thumb, like this:
seek.setThumb(Main.app.getResources().getDrawable(R.drawable.thumb));
seek.setThumbOffset(15);
This will set the correct offset when your thumb is very long.
Try to change the thumb offset property, after that it will not go off from the seek bar
I just ran into this issue. I was able to get satisfactory results by using android:paddingLeft and android:paddingRight within the XML.

Categories

Resources