Timepicker as a draggable bar

Asked

Viewed 70 times

0

It is possible to make a timepicker this image shape? So I can put in a range, hours. If so, is there an example or a library? If not, any suggestions?

Imagery:

inserir a descrição da imagem aqui

1 answer

3


Yes, it is possible to make a customization of the Seekbar, but natively has only one slider. To create 2 controls, if you are in a hurry, can use a lib ready. Here are some examples:

But it’s not just that. Then you must set the maximum value of SeekBar in 1440, which represents exactly the amount of minutes in 24 hours. This considering that you will not use the "seconds" factor. Then the calculation is simple:

int hours = valueMax / 60;     // o resultado representa as horas
int minutes = valueMax % 60;   // o resultado representa os minutos

This you will have to do for each of the sliders.

  • @ramaral you know timepicker in the format of seekbar? That would be my suggestion, that it might even give a little work, but it will work.

  • I researching also just found this style that you made, I’m testing here and I return you. I am using this https://android-arsenal.com/details/1/3996

  • @Henriquemendes I have something almost ready here, but I can’t help you now. Try there, anything if you can’t, give me a call. But the logic is this. If it were the case to use in an application of mine, I would do so.

  • I used the library I passed above, and its logic worked, to bring the minutes and hours, thank you very much!

  • @Acklay, no, I don’t know but your solution is feasible. Remember that the @nome doesn’t always work, I found your comment by chance.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.