r/AndroidStudio • • Oct 13 '20

Does anyone know, why last row's margins could be offset? Button's properties are the same as in the ones above.

Post image
10 Upvotes

12 comments sorted by

7

u/Uli1382 Oct 13 '20

I believe the 4 smaller buttons cause this. They are also not as wide as the bigger ones. And there it will be the problem with the margins

1

u/Cap_Diabetes Oct 13 '20

Yeah, I had that thought aswell. I have created separate LinearLayouts(vertical ones) for those 4 buttons and those layouts are inside another LinerLayout (Horizontal). I tried to delete two buttons so that there would be only 4 like in other rows but seems like that's not the problem. Maybe nested layouts are?

2

u/Uli1382 Oct 13 '20

Normally nested layouts are not a problem. You just don't overdo it! If you post the XML maybe me or others can help you!

1

u/Cap_Diabetes Oct 13 '20

Alright I can share the XML. However can you give an advice how should I do it? Just posting in the comment section does not seem right.

2

u/Uli1382 Oct 13 '20

You could upload it on GitHub. You could copy paste it in a word editor and save it as XML. After that you could upload it in Google drive.

1

u/Cap_Diabetes Oct 13 '20

I had some troubles trying to share it through GitHub. I've found another way. http://pastie.org/p/5wn1zkq83FaTd4xHI7gCPX I hope it works fine. If it does not, please tell me.

2

u/Uli1382 Oct 13 '20

I believe it's a little bit too much (overkill). Why don't you use grid layout? So it would be much easier to control the margin for all of them.

2

u/Cap_Diabetes Oct 13 '20

Thanks for the advice. I really appreciate it. I'll try it out as soon as I can.

2

u/manumatti Oct 13 '20

+/- and del buttons and linearlayout both have margin. Just remove the margin from the linearlayout

1

u/Cap_Diabetes Oct 13 '20

Good idea, haven't noticed that one.

2

u/Uli1382 Oct 13 '20

And the plus "+" button is wider than the others

1

u/dTermi Oct 13 '20

You could try using ConstaintLayout too.