Frage

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?

War es hilfreich?

Lösung

Drop a TPanel on the form and add your buttons to it. Then set the Align property of the TPanel to alCenter.

Andere Tipps

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)

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top