2

I noticed in the properties of the designer you can center the text in a label, etc. did not see anything that allows you to center the view itself.

For example, I looked at the properties for a button. There is Horizontal Alignment and Vertical Alignment for Text Style but I don't see anything like that for Button Properties.

Is there a way to control the button alignment?

Thanks.

Emad-ud-deen
  • 4,734
  • 21
  • 87
  • 152
  • Do you want to center the button in relation to the Panel or Activity? – Erel Nov 07 '11 at 12:12
  • Hi Erel. The activity because I know if I put buttons on a panel the panal can be centered. It's not just buttons but other views as well such as labels, etc. I would like to set the position. Thanks. – Emad-ud-deen Nov 07 '11 at 13:02
  • I know this comment is a bit off topic, but I just wanted to say basic4android is really a nice software. I'm hoping that after I become very comfortable with it I can find employment for myself and be able to compete with the Java Android developers out there because this software will allow an app to be completed in a fraction of the time it would take otherwise. – Emad-ud-deen Nov 07 '11 at 13:07

2 Answers2

2

You will need to do it programmatically:

Sub CenterView(v As View, parent As View)
    v.Left = parent.Width / 2 - v.Width / 2
    v.Top = parent.Height / 2 - v.Height / 2
End Sub

For example:

CenterView(button1, Activity)
Erel
  • 1,802
  • 2
  • 15
  • 58
0

If you do have access to the .xml files ( I'm no basic4android expert ), you can look into the properies layout_gravity and gravity, depending on how you want to center.

Good luck!

/RandomSort

RandomSort
  • 600
  • 7
  • 22