Android seekbar解决方案

编程入门 行业动态 更新时间:2024-10-25 06:32:47
本文介绍了Android seekbar解决方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

是否可以仅在移动拇指时使搜索栏移动. 现在,即使在手指触摸时,搜寻栏也会移动 可进度绘制.我们如何禁用搜寻栏的移动 手指触摸进度图?

Is it possible to have the seekbar move only when the thumb is moved. Right now the seekbar moves even on finger touch in the progressdrawable. How do we disable the movement of the seekbar on finger touch of the progressdrawable?

谢谢.

推荐答案

覆盖 OnTouchListener 用于搜寻栏,并且仅在MotionEvent是移动事件时处理拇指上的移动.

Override the OnTouchListener for the seekbar and only process the movement on the thumb when the MotionEvent is a move event.

event.getAction() == MotionEvent.ACTION_MOVE

更新:1

类似的事情会起作用,但是要注意的是,即使用户将拇指移动了2个单位,搜索栏也会移动.而且您真的不应该停止这种行为,因为它会破坏搜索栏.

Something like this will work but the catch is that even if the user moves the thumb 2 units the seekbar moves. And you should really not stop this behavior as it would mess the the seekbar.

seekBar.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if(event.getAction() == MotionEvent.ACTION_MOVE){ Log.d(TAG, "Moved , process data, Moved to :" + seekBar.getProgress()); seekBar.setProgress(seekBar.getProgress()); return false; } Log.d(TAG, "Touched , Progress :" + seekBar.getProgress()); return true; } });

更多推荐

Android seekbar解决方案

本文发布于:2023-10-08 02:48:30,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1471289.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:解决方案   Android   seekbar

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!