Android Question Centrar Botones en un layout Horizontal

lorenilla26

Member
Licensed User
Hola, me podran ayudar?. Tengo 5 botones, idependientes uno del otro y necesito que aparezcan centrados en un layout horizontal. Es decir que ocupen toda la pantalla horizontalmente. ¿como puedo hacerlo?. Si lo hago de forma manual y el tamaño del fono o tablet es distinto no aparecen correctamente.

ejemplo:
emoji-feedback-scale-with-stars-icon-level-survey-of-customer-satisfaction-customers-mood-from...jpg


Muchas gracias,

LG.
 

asales

Expert
Licensed User
Longtime User
Hola LG.
This is the english part of the forum.
Please, post your question in english or in the spanish forum.

You can use HorizontalCenter in designer to adjust the buttons:
B4X:
button1.HorizontalCenter = 20%x
button2.HorizontalCenter = 35%x
MiddleButton.HorizontalCenter = 50%x
button4.HorizontalCenter = 65%x
button5.HorizontalCenter = 80%x
 
Upvote 0

teddybear

Well-Known Member
Licensed User
El método más simple

B4X:
Button1.Height = 50dip
Button1.Width = 50dip

Button2.Height = 50dip
Button2.Width = 50dip

Button3.Height = 50dip
Button3.Width = 50dip

Button4.Height = 50dip
Button4.Width = 50dip

Button5.Height = 50dip
Button5.Width = 50dip

Button1.Left = 16.7%x - 25dip

Button2.Left = 33.4%x - 25dip

Button3.Left = 50%x - 25dip

Button4.Left = 66.7%x - 25dip

Button5.Left = 83.4%x - 25dip
 
Upvote 0

josejad

Expert
Licensed User
Longtime User
Hi Lorena:

Please check this example


Como te han comentado, en esta parte del foro deberías preguntar en inglés. Para hacerlo en español, usa este foro.

saludos,
 
Upvote 0
Top