Android seekbar如何在短时间内阻止拖动/禁用它 [英] Android seekbar how to block dragging / disable it for short time
本文介绍了Android seekbar如何在短时间内阻止拖动/禁用它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果值是true,我想阻止对搜索栏的拖动.这有可能吗?我使用搜索栏作为开关.如果我的搜寻栏值为0,并且我按下按钮,则动作A开始.如果我的搜寻栏值为1,然后按下按钮,则动作B开始.
我要防止如果操作A或B正在运行,则将搜索栏拖动到另一个位置.
我该如何实现?
I want to block the dragging of a seekbar if a value is true. Is this even possible? I use a seekbar as a switch. If my seekbar value is 0, and I press the button action A started. If my seekbar value is 1 and I press the button action B is started.
I want to prevent that If action A or B is running the seekbar is dragged to another position.
How can I achieve this?
推荐答案
您应该设置自己的onTouchListener并返回true.
You should set your own onTouchListener and just return true.
seekBar.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
return true;
}
});
这篇关于Android seekbar如何在短时间内阻止拖动/禁用它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文