I am attempting to create a Fragment
for an Android application where I have either Button
s or ImageButton
s programatically arranged in a circle, with lines drawn from them to the center of the View
. However, I have become stumped as to how to do this.
From my understanding, I can create a custom View
in which I can override the onDraw()
to draw the lines, but I cannot put the Button
s in this way. I can overlay the custom View
with a FrameLayout
or the like, but I do not know what type of layout to use so that the buttons can be arranged in a circle (and that this will work for various screen sizes).
Furthermore, I have to ensure that both the drawn lines and the buttons will be able to be animated together (that is, for instance, the buttons and connecting lines can move off-screen at the same rate as if they were one entity).
I have seen this post, and it is actually very similar to what I would like to do! : Dynamically arrange Buttons around a Circle . However, I do not quite have a satisfactory understanding of the answer, particularly how a Button
can be created in an onDraw()
with onClick
still functioning.
Any suggestions would really be appreciated!