Drop a TPanel on the form and add your buttons to it. Then set the Align property of the TPanel to alCenter.
Delphi XE5 center android layout
-
28-06-2022 - |
Question
I am developing an android app with Delphi XE5 and I have the Google Nexus 4
layout. For example, the screen dimensions of a Samsung Galaxy S4
are different from the Nexus's one.
I have a panel that contains some stuff like buttons, edits and labels. I'd like to center-align this panel, so everytime it is in the middle of the screen.
How could I do this?
La solution
Autres conseils
I think you'd have to use the resize event of the form to set the position.X value of the panel, eg.
MyPanel.Position.X := Round((MyForm.Width - MyPanel.Width) / 2);
Use a TLayout component and adjust the Align property.
See also Mobile Tutorial: Using Layout to Adjust Different Form Sizes or Orientations (iOS and Android)
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow