Android: GridLayout spacing between items-ThrowExceptions

Exception or error:

I have a grid layout which is filled with buttons, now i want the buttons to be more distant from each other, what code should i write? i tried to search it but only found a solution for GridView, not GridLayout.

How to solve:

You can put margin to the buttons


Instead of adding margin to each buttons, use android:useDefaultMargins="true"

It is better than adding margin to each buttons!

Leave a Reply

Your email address will not be published. Required fields are marked *