-1

**enter image description here**

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

angh
  • 75
  • 2
  • 12

1 Answers1

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