Need to create a meter of this sort..how to create buttons of different shape and arrange like the meter shown below. or just how to create buttons in different shapes Thanks in advance
Asked
Active
Viewed 112 times
1 Answers
0
If you want advanced behaviour for these buttons you need to create a custom button
by extending and overriding the existing Button
provided by the SDK.
Have a look here for some theory.
However, if you just need to replace the images and use them as normal buttons you could just use an ImageButton
with your custom image!
From a quick read, I think this could be a valid example for this.
As for the layout part, I would do something like this:
<Whatever root ViewGroup you are using for your activity>
<ConstraintLayout to place correctly your buttons>
<ImageButton1 blah blah />
.........
<ImageButtonN blah blah />
</ConstraintLayout to place correctly your buttons>
</Whatever root ViewGroup you are using for your activity>
EDIT: @crgarridos suggested you a CircularLayout
. My answer was influenced by the fact that I did not know that (it's not in the standard library pardon me for this) and wanted to avoid making you create a custom layout. By the way, I've searched for it and found this that might help more than my answer!

magicleon94
- 4,887
- 2
- 24
- 53
-
if i were to use image buttons how should i place those butons in circle? – angh Sep 15 '17 at 09:55
-
I would suggest a `ConstraintLayout` in order to keep the relative order between the buttons. – magicleon94 Sep 15 '17 at 10:06
-
-
Basing on @crgarridos's comment I've edited the answer adding an alternative – magicleon94 Sep 18 '17 at 07:18