【问题标题】:how to speed up the forward/rewind process when button pressed continuously连续按下按钮时如何加快前进/后退过程
【发布时间】:2014-11-11 07:49:17
【问题描述】:

如果连续按下按钮,我想增加快进/快退速度。

我从 here 创建了我的自定义媒体控制器。

加快前进/后退过程的好方法是什么?

我有一些想法来自here。最后我也实现了它,但触摸事件在我的模拟器或安卓手机中也成功运行,但不适用于安卓机顶盒。其他解决方案而不是使用它将不胜感激。

【问题讨论】:

    标签: android android-mediaplayer android-tv


    【解决方案1】:

    您如何监视 MotionEvent.ACTION_DOWN 和 MotionEvent.ACTION_UP 并查看按钮按下了多长时间。

    button.setOnTouchListener(new OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            if(event.getAction() == MotionEvent.ACTION_DOWN) {
                // the button is down monitor time to see how long it is down or anything you want
            } else if (event.getAction() == MotionEvent.ACTION_UP) {
                // the button is up reset your timer
            }
        }
    };
    

    【讨论】:

    • 正如我在上面的问题中提到的,touchlistener 在我的情况下不起作用。
    猜你喜欢
    • 1970-01-01
    • 2011-01-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-07
    • 1970-01-01
    • 2018-11-28
    • 2013-06-17
    相关资源
    最近更新 更多