android 如何检测水平滚动视图中画布上的点击
您好,我有一个水平滚动视图,在其中我在画布上绘制了一些弧线,这给了我一组可水平滚动的饼图。现在我需要处理每个饼图的点击事件,有人可以帮助我解决同样的问题吗?
ChartUtility sampleObject=new ChartUtility(getActivity());
sampleObject.draw(new Canvas());
ChartContainerLayout.addView(sampleViewObject);//here chartcontainerlayout is a linear layout which his present in a horizontal scrollview.
我尝试过chartutility类的ontouch事件。但无论是什么操作(单击/水平滚动), event.ACTION 都会以“向下”的形式返回。那么我应该如何识别单个项目的点击事件。
Hi I have a horizontal scrollView and inside it I draw some arcs on canvas which gives me set of horizontally scrollable pie charts. Now I need to handle the on click events of each of the pie charts, could some one help me regarding the same.
ChartUtility sampleObject=new ChartUtility(getActivity());
sampleObject.draw(new Canvas());
ChartContainerLayout.addView(sampleViewObject);//here chartcontainerlayout is a linear layout which his present in a horizontal scrollview.
I have tried the ontouch event of chartutility class. But what ever is the action(either a click/horizontal scroll), the event.ACTION is being returned as "down". So how should I recognize the click event on individual items.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我会将方向设置为水平的 LinearLayout 放入 HorizontalScrollView 中,然后将每个饼图置于其中的单独布局中。然后在这些布局上设置侦听器。我不会将点击处理与滚动混合在一起。
I would put a LinearLayout with orientation set to horizontal into the HorizontalScrollView and then make each pie chart in a separate layout within that. Then set listeners on those layouts. I would not have the click handling mixed with the scrolling.