I want to create a custom progress bar that looks like this
http://i.stack.imgur.com/NK5Px.png
it should progress until it reaches one of the circles light it up and continue towards the next one until it reaches the last one.
What is the best approach to implement this?
- whether to extend progress bar and override onMeasure() & onDraw()
- or to create compound component with layout as root and populate it with progress bar
and some circle like views.
Update
on the first approach i wonder how to make the progress bar half the size of the control and center it?
the other approach will make me use nested layouts, and seems to be more complex to create..What do you think? there is a completely different way to do it properly and easily?
Related
I am using the material design for my discrete bar. More specific this ones
Discrete bars. So what I need is to be able to see the progress without clicking on it. Soo far from my researches I found nothing for this. Something like this in first and second activity.
Discrete Bars
First Activity
Second Activity
I wanna make a bar which changes to a different colour until the point where it is touched. Like this:
A seek bar will probably suit your needs very well, since you can customize the bar color, the bar itself and the progress indicator.
If you want it vertical you can probably use setRotation() (even though I'm not sure since I never actually used it I don't see why it wouldn't work).
I am trying to create a seekbar with horizontal progress bar on thumb. Visually it should look something like this.
So when i seek the thumb left to right the progress bar will act according to the value of seekbar.
So far i had try to overlap a progress bar on the top of seekbar, but this is not working as expected. Also i am not able to pass the touch event from progress bar to seekbar. As progress bar is overlapping the thumb i need to bypass the touch event from progress bar to seekbar thumb, which i am not able to achieve it.
Can anyone help me changing existing code or completely create a new custom seekbar by extending base class.
If you don't want to code the wohle thing yourself, there is a github project that displays the value inside the thumb. However, this is not very similar to the image you provided, but maybe could be styled.
The other option is coding it yourself. You will basically have to extend SeekBar and override the most important methods ( onDraw, onMeasure etc. )
There are plenty of tutorials on how to make custom views, like this one from the android developer pages.
I am trying to make a custom bar like this
However those red boxes are actually images ( nicely designed segments) and the arrow is an image indicator to clarify the progress. I am just showing the image above as an illustration.
I know how to do custom progress bar using gredients and colors but in case of something like that with images. How would I do it? Can it be done through xml or should I create custom view and override the ondraw method to do things from scratch? Any design help is appreciated
Thanks
I have scenario where I have to show some level using a progress bar, but according to the design this progress bar has a thumb like circle on it too.
Now the user is not supposed to change the value of this bar either by touch or by using keys.
The 'thumb' is available in Seek bar but not in Progress bar, but Seek bar is capable of taking focus and touch events, while this should not happen in my case.
So for handling the focus and make my seek bar "foussable = false" & "focussableInTouchMode = false", but what should I do to make it non-touchable almost like a progress bar ?
Another option is to call setOnTouchListener and use a listener that always returns false. Note that this UI is confusing to users as you want the seekbar to look like an active one, but not behave like an active seekbar. For UI consistency, using setEnabled(false) is more consistent, and the colors are different for a good reason.
what you can do is, create custom seekbarwith following two property, and call enable(false)
android:progressDrawable="#drawable/progress_bar"
android:thumb="#android:color/transparent" // to make thumb invisible
and then call for runtime
SeekBar.setEnabled(false)
and from xml
android:enabled="false"