在Android中设置后如何删除OnSeekBarChangeListener?

发布于 2024-12-25 12:27:16 字数 244 浏览 1 评论 0原文

我四处搜寻并尝试了一些建议,但仍然没有成功。

我有一个包含搜索栏的列表视图,用于在代码中设置参数。我想基于切换按钮触发搜索栏侦听器,以便用户在滚动列表时不会意外移动搜索栏。

我的问题是,一旦关闭切换,搜索栏侦听器仍然处于活动状态。我尝试将 null 传递给 setOnSeekBarChangeListener,但它不起作用。

感谢您的帮助。我是 Android 的新手,处理用户输入事件链仍然让我感到困惑。预先感谢您的帮助。

I've searched around and tried some of the suggestions but still no success.

I have a listview that contain seekbars that are used to set parameters in the code. I would like to trigger the seekbar listener based on a toggle button so that the user does not accidentally move the seekbars while scrolling the list.

my problem is that once the toggle is turned off, the seekbar listener is still active. I've tried passing null to the setOnSeekBarChangeListener, but it does not work.

thanks for your help. I'm a newbie to Android and handling the user intput chain of events is still confusing to me. Thanks in advance for your help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

太阳哥哥 2025-01-01 12:27:16

这应该有效。

myView.setOnSeekBarChangeListener(null);

This should work.

myView.setOnSeekBarChangeListener(null);
随梦而飞# 2025-01-01 12:27:16

试试这个..

mySeekBar.setEnabled(false);

编辑:

尝试将焦点设置为 false 像这样..

  mySeekBar.setFocusable(false);

Try this..

mySeekBar.setEnabled(false);

EDIT:

Try setting the focus to false like this..

  mySeekBar.setFocusable(false);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文