Delphi XE5 Platform Location

I am developing an Android application with Delphi XE5 and I have a Google Nexus 4 layout. For example, the screen sizes of a Samsung Galaxy S4 are different from the screen of Nexus.

I have a panel containing some elements, such as buttons, edits and labels. I would like to center this panel, so every time it is in the middle of the screen.

How can i do this?

+4
source share
3 answers

Drop the TPanel in the form and add your buttons to it. Then set the Align property for TPanel to alCenter.

+8
source

I think you will need to use the form resize event to set the position.X value of the panel, for example.

 MyPanel.Position.X := Round((MyForm.Width - MyPanel.Width) / 2); 
+2
source

Use the TLayout component and configure the Align property.

See also Mobile Guide: Using Layout to Customize Different Formats or Orientations (iOS and Android)

0
source

Source: https://habr.com/ru/post/1502291/


All Articles