Android Question Center Align Buttons in a row

kozbot

Member
Licensed User
Longtime User
Hi all,

I have 5 social media buttons in a row along the bottom of my app, but no matter what I do, I can't center the middle button without it skewing out of shape on different phones. Does anyone have a way to align all the buttons so that they look the same on all phones. My buttons are currently on a panel, I've added an image of what I'm trying to achieve, but this is on my personal phone, when I see the UI Cloud, it looks terrible and cut off on others.

Thanks in advance for the help!!!!

Phone Layout.jpg Phone Layout 2.png
 

LucaMs

Expert
Licensed User
Longtime User
I think you have two options:

a) Fixed buttons: in this case you will have to use percentages related to the panel for their size and distances;

Example:
B4X:
pnlBottom.Width = 100%x ' or other

ButtonWidth = pnlBottom.Width * .15
HorDist = (pnlBottom.Width - 5 * ButtonWidth) / 4

btnFB.Width = ButtonWidth
btnFB.Height = btnFB.Width ' if it should be squared
btnFB.Left = ...

btnGoogle.Width = btnFB.Width
btnGoogle.Height = btnFB.Height
btnGoogle.Left = ... + HorDist

' etc.


pnlBottom.Height = btnFB.Height



b) sliding buttons: use a HorizontalScrollView or another view.


Note: I have an old designer; with the new there may be easier solutions
 
Last edited:
Upvote 0
Top