Android禁用音频控制器的搜索栏 [英] android disable seek bar for audio controller

查看:62
本文介绍了Android禁用音频控制器的搜索栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下搜索栏来替换音频的进度.

I used the following seek bar for displacing the progress of my audio.

<SeekBar
    android:padding="7dp"
    android:id="@+id/SeekBar01"
    android:layout_width="245dip"
    android:thumb="@drawable/seekthumb2"
    android:progressDrawable="@drawable/seekbar1"
    android:layout_height="fill_parent"
    android:clickable="false"
    android:focusable="false"

    android:longClickable="false"/>

我想禁用此搜索栏的手动运动.我的意思是,搜索只能通过我的代码移动,而不能通过任何其他方式(触摸)进行访问.

I want to disable the manual motion of this seek bar. i mean the seek can only move by my code and it cannot be accessed by any other means (Touch).

推荐答案

只需添加触摸事件处理程序并返回true,如下例所示:

Just add touch event handler and return true, like example below:

    seekBar.setOnTouchListener(new OnTouchListener(){
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            return true;
        }
    });

用户将无法以这种方式触摸和更改进度.

User won't be able to touch and change the progress this way.

这篇关于Android禁用音频控制器的搜索栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆