自定义按钮Android增加了触摸事件的百分比

发布于 2025-02-06 21:38:31 字数 199 浏览 0 评论 0原文

我需要在Android中实现此UI。当向右滑动时,它会增加百分比和蓝色视图在两种方面增加,而滑动左右则减少了它,在文本视图中,视图和百分比。我能做到的任何想法吗?谢谢

在此处输入图像描述

I need to achieve this UI in Android. When sliding right, it increases the percentage and the blue view increases in both ways, and when sliding left it decreases it, both view and percentage in TextView. Any ideas I can do that? Thanks

enter image description here

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

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

发布评论

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

评论(1

伪心 2025-02-13 21:38:31

我使用了 library 它的设计几乎与所需的设计相同。如果不方便,您可以检查实现并创建自己的自定义视图。基本上,您需要在onTouchListener中跟踪触摸事件,并用从OnTouch获得的坐标来借鉴画布。

I used the library that has almost the same design that you need. If it's not convenient for you can check implementation and create your own custom view. Basically you would need to track touch events in OnTouchListener and draw on Canvas with coordinates that you got from OnTouch.

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