单击按钮时搜索栏的移动

发布于 2024-12-28 18:02:15 字数 237 浏览 2 评论 0原文

我有疑问要问。

我如何在按钮单击上移动搜索栏并以 0.25 递增,

即我创建了两个按钮 + 用于增加,- 用于减少。这可能吗?

我已将seekbar 的“max”设置为60,并且onProgress 更改我将进度值乘以0.25,以将精度增加0.25。但是我的搜索栏不会在每次按钮单击时移动,即对于值 0 到 1,它不会从 0.25 移动到 0.75,从 0.75 单击后它会移动到 1。我没有让它在每个值上移动。

i have a query to ask.

How can i move a seekbar on a button click incrementing by 0.25

i.e i have created two buttons + for increase and - for decrease.Is it possible??

I have set "max" of seekbar 60 and onProgress change I am multiplying the progress value by 0.25 to increment my precision by 0.25. But my seekbar is not moving on each button click i.e for value 0 to 1 it doesn't move from 0.25 to 0.75, after clicking from 0.75 it moves to 1. I am not getting it to move on each value.

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

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

发布评论

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

评论(1

过度放纵 2025-01-04 18:02:15

AFAIK,您不能使用浮点值作为微调器的进度。它必须是一个整数值。因此最好将最大进度设置为整数值,该整数值是您希望用户到达微调器最右侧的点击次数的总和。

前任。您希望用户在微调器中从左到右点击 10 次,只需将最大进度设置为 10。

因此,如果您想要像您所要求的行为,那么..

例如:您希望用户看到 1 到 5 的进度递增每次他点击微调器时为 0.25,然后将您的进度设置为 5*4=20,然后显示增量,因为每次点击都会添加 0.25。但是实际上,您只需将进度增加 1。
在此处输入图像描述

AFAIK,you cannot use float value as progress of spinner. It must be an Integer value.so better you set maximum progress as an integer value that is total of how many clicks you want user to reach to right most side of spinner.

Ex. you want user to give 10 clicks for going from left to right in spinner,just set maximum progress as 10.

So if you want behavior like you asked for,then..

For Examlple: you want user to see 1 to 5 progress incremented by 0.25 each time he clicks on spinner,then set your progess as 5*4=20 and then show increment as it is added by 0.25 in each click.but actually you will have to increment progress by 1 only.
enter image description here

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