aptyp
aptyp

Reputation: 251

Android, button - custom shape

I want to create a few buttons in shape of piece of pie chart and i know how to do that, but I have no idea how to place them in one element like a pie chart. Any ideas?

I have 5 buttons in this shape:

enter image description here

and I want to achieve sth like this:

enter image description here

But I dont know how to do it

Upvotes: 1

Views: 706

Answers (1)

Tim
Tim

Reputation: 35933

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.

Upvotes: 2

Related Questions