I am trying to create a custom seekbar. I have used vectors for progress drawable and thumb as:
android:thumb="#drawable/custom_seekbar_thumb"
android:progressDrawable="#drawable/custom_seekbar_progress"
android:splitTrack="false"
Right now my seekbar looks like this:
As you can see the pink vector image that I have used for progressDrawable doesn't occupy the entire width of seekbar - there is some gap between the drawable and seekbar in the right side.
How do I make my progress drawable occupy the entire width of the seekbar?
Fixed this issue simply by using android:paddingEnd="0dp" in Seekbar.
Related
I have a question about a seekbar.
Everything works perfect, but I have a Problem with the background and the thumb.
I can add a background with a special size of the thumb. If I change the size of the seekbar the background size will change identical to the seekbar size but
the thumb keeps the original size. (I know that I can change the width and the height of the thumb with the attributes.)
Now the question: Is there a way that the thumb changes automatically the size when I change the seekbar size inside the activity_main like the background.
I need this for a special LED Bar.
I hope this pictures will help to understand it
image1
image2
The frame is the Background of the seekbar. If i change the size the frame size will be changed automatically. The thumb will not changed
How can i increase seekbar thickness? I would like to have this horizontal line very thick plus have thumb with much bigger circle. (holo.light)
Do I really have to create my own drabawbles? I hoped that changing only some attributes would be enough....
I have a layout in Android which contains a SeekBar element. Both the height and width of the SeekBar are set as "fill_parent". The parent has a layout_weight, and changes size depending on the size of the screen on which it is displayed.
The problem I'm having is that I need to use a custom graphic as the thumb image on the SeekBar, but the image won't scale to match the SeekBar size. Sometimes it is too small, and other times too big. I tried adding android:scaleType="fitXY" to the SeekBar, but this didn't help. I also tried wrapping the thumb image in a ScaleDrawable, but this didn't work either.
Does anyone know how to accomplish this?
I'm having problems with a custom seekbar thumb (aka scrubber control). The thumb is clipping whenever I press on it, then goes away once I drag it. I've already added padding to the right and left of the seekbar to accommodate the thumb at the ends. This image shows what's happening at different stages of progress and while idle at either end:
I've also tried adding a thumb offset to the seekbar: android:thumbOffset="0dp". The result is no more clipping when pressed, but now the scrubber control does not move to the very end of the bar on either side. This image shows the seekbar with thumbOffset:
All of the scrubber control drawables are the same size, so the image size isn't changing size when the state becomes pressed. Is there some way to get no clipping while pressed and still have the scrubber control move to the very ends of the bar?
Use PaddingLeft and PaddingRight and thumbOffset attribute for your SeekBar.
Try setting your padding AND your thumbOffset to half the width of your thumb.
I.e. if the width of your thumb is 30, set padding="15dp" and thumbOffset="15dp"
I'm trying to make a timeout gauge bar animation effect:
The width of a lengthy colorful bitmap image is decreasing, but not x-scaling.
so the image looks not changing and the visible area shrinks.
I couldn't find the sole ImageView clipping or masking support in android.
And I managed to get the clipping effect by surrounding the ImageView in ViewGroup like:
<FrameLayout android:id="#+id/shrink_box" ...>
<ImageView android:src="#drawable/still_image" ...>
</FrameLayout>
then changing the shrink_box's width will clip the portion of the still_image.
But I failed to change the width of the view smoothly.
I tried to change the LayoutParam.width in applyTransformation() but got an Exception, it seems not allowed.
How can I make an Animation that changes the width of the view. OR is there a proper method to achieve the above effect?
You are trying to reinvent the wheel here, just use a ProgressBar and set the progress drawable to your image.
In your xml layout give the ProgressBar this style to make it an actual bar rather than a wheel
style="#android:style/Widget.ProgressBar.Horizontal"