Android 时间范围搜索栏 [英] Android Time Range Seek Bar
问题描述
我想允许我的应用的用户修剪视频中的特定部分.而且我正在寻找一种解决方案,可以帮助我使用两个拇指(最大和最小时间)制作时间选择滑块.
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:
但它们只适用于浮点数和整数.我的问题是如何使它与时间值一起工作?
But they work only with floats and integers. My question is how can i make it work with time values ?
推荐答案
基本上你可以用数字类型来表示时间!使用整数,您可以将时间范围从 0
到 Integer.MAX_VALUE
秒(例如)
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)
您需要的是以 mm:ss
格式显示这个 int 值.
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.
另一个例子(使用millis)SO链接>
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));
这篇关于Android 时间范围搜索栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!