How To Create a Rotating Wheel Control?(如何创建转轮控件?)
问题描述
我正在尝试在android中实现转轮,就像下面显示的图像.我从这个链接.但我想实现如下图所示.轮子由单独的图像组成.有人对这个实现有任何想法吗?任何帮助将不胜感激.
I am trying to implement the Rotatory wheel in android, just like the image displayed below.I came across the tutorial from this link. But i want to implement just as shown in the below image.The wheel consists of individual images.Does anybody have any idea regarding this implementation?? Any help would be appreciated.
提前致谢.
阿卡什
推荐答案
应用在imageView上的OnTouchListener上,通过它我得到了三个事件:
Applied on OnTouchListener on the imageView through which i got three events namely:
- MotionEvent.ACTION_DOWN、
- MotionEvent.ACTION_MOVE &
- MotionEvent.ACTION_UP.
- MotionEvent.ACTION_DOWN,
- MotionEvent.ACTION_MOVE &
- MotionEvent.ACTION_UP.
在 MotionEvent.ACTION_DOWN 上获得用户触摸的角度,在 MotionEvent.ACTION_UP 上获得用户释放的角度.
On MotionEvent.ACTION_DOWN got the angle where the users touches and on MotionEvent.ACTION_UP got the angle where user releases.
得到两个角度的差异后,旋转那个角度的图像.
After getting difference of the two angles,rotated the image of that angle.
旋转图像后,通过角度检查象限并保持 int 变量,该变量根据象限递增,并通过满足条件设置新图像(所需的图像).
After rotating the image checked the quadrant through angle and maintained int variable which incremented according to the quadrant and by fulfilling the condition set the new image(the desired one).
根据int变量的值维护点击事件.
Maintained the click event according to the value of the int variable.
这篇关于如何创建转轮控件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何创建转轮控件?
基础教程推荐
- 如何在 UIImageView 中异步加载图像? 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01