Android:如何制作“饼图”带有可触摸的楔子 整个东西可以旋转
我需要制作一种“饼图”式的圆形显示。图表的楔子必须是可触摸的,并且整个圆圈必须能够旋转 360 度..
我仍然是一个 Android 菜鸟,但我猜我不能用布局来做到这一点..对吧?
最好,楔子是我在 Photoshop 中创建的图像资源,而不是以编程方式创建的,
有人知道从哪里开始吗?
I have need to make a sort of "Pie Chart"-style circular display. the wedges of the chart have to be touchable, and the whole circle has to be able to spin 360deg..
I'm still an android noob, but I'm guessing that I can't do this with a Layout.. right?
preferably, the wedges would be image assets that I create in Photoshop, and not programmaticaly created
does anyone have any Idea where to start with this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于这种不规则的布局,您最终将使用
SurfaceView
并将楔形绘制到Canvas
上。您需要获取触摸的 xy 坐标,并自行计算出哪个楔子已被触摸并采取适当的操作。For such an irregular layout, you're going to end up using a
SurfaceView
and drawing the wedges onto aCanvas
. You'll need to grab the x-y coordinates of touches and work out yourself which wedge has been touched and take appropriate action.