Android Time Range Seek Bar

筅森魡賤 提交于 2019-12-11 11:05:43

问题


I want to allow the user of my app to trim a specific part from a video. And i'm looking for a solution that can help me make a time selection slider with two thumbs(Max and Min time).

This is a sample of what i want to achieve .

I know that there is already some librarys that can help:

android-range-seek-bar

Material Range Bar

But they work only with floats and integers. My question is how can i make it work with time values ?


回答1:


Basically you can represent time with a numeric type! With integer you can have a range time from 0 to Integer.MAX_VALUE seconds (for example)

What do you need is display this int value in a mm:ss format.

I don't know if the libs up here already do this, however I suggest to fork one on that and work on the values displayed on screen.

Example from another (using millis) SO link

String hms = String.format("%02d:%02d:%02d", TimeUnit.MILLISECONDS.toHours(millis),
    TimeUnit.MILLISECONDS.toMinutes(millis) % TimeUnit.HOURS.toMinutes(1),
    TimeUnit.MILLISECONDS.toSeconds(millis) % TimeUnit.MINUTES.toSeconds(1));


来源:https://stackoverflow.com/questions/37243318/android-time-range-seek-bar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!