我想创建一些饼图形状的按钮,我知道该怎么做,但我不知道如何将它们放在一个像饼图这样的元素中。有任何想法吗?
我有 5 个这种形状的按钮:
我想实现这样的目标:
但我不知道该怎么做
I don't believe there's any way to do this with stock Buttons. What you probably want to do is to extend a View
into your own custom class, and override the onDraw
method to draw the pie chart with whatever algorithm you want to use to draw a segmented circle.
Then on onTouch
you can compare the touch X/Y coordiante versus the pie segments you drew and then do some action based on which segment of the pie was clicked.