amit 3 Posted January 1, 2021 Hi, I try to create simple android app using FMX component. I create the Galaxy Note 5 view from its specification, Screen Resolution: 1440x2560, PPI=518, Screen size = 5.7". I place 3 buttons on the form and compile and run. It is working fine but the position of all buttons is displayed inproperly as s The pictures at design time and on the actual device (Note 5) are attached. Here is the code on package of the View I made. unit Note5; interface implementation uses system.Devices, system.Types, system.SysUtils; const ViewName = 'Note5'; // The unique name of the view, it has to be the same name as the one written between <Name></Name> tags of the DevicePreset.xml file. initialization TDeviceinfo.AddDevice(TDeviceinfo.TDeviceClass.Phone, ViewName, TSize.Create(1280,720), TSize.Create(586, 330), // MinPhysicalSize(max, min), MinLogicalSize(max, min) TSize.Create(2560,1440), TSize.Create(1280, 720), // MaxPhysicalSize(max,min), MaxLogicalSize(max,min) TOSVersion.TPlatform.pfAndroid, 518); //Select the platform and the pixel density. finalization TDeviceinfo.RemoveDevice(ViewName); // To unregister the view after unistalling the package. end. Share this post Link to post
Guest Posted January 2, 2021 (edited) hi @amit maybe your problem is not a real problem, but, just "alignment" or "adjustment" of the UI components. in FMX, you can use or abuse, of TLayout component for this task! Include you can have TLayout into another TLayout! ok? You can use the properties, like: Align, Anchors, Padding, Margins, Scale (for a particular cases), etc.. etc.. for better adjust your template of corse, you need test it if the "sizes" go to "override" others components adjacents, you see? object Form1: TForm1 Left = 0 Top = 0 Caption = 'Form1' ClientHeight = 608 ClientWidth = 424 FormFactor.Width = 320 FormFactor.Height = 480 FormFactor.Devices = [Desktop] DesignerMasterStyle = 0 object Layout1: TLayout Align = Client Size.Width = 424.000000000000000000 Size.Height = 608.000000000000000000 Size.PlatformDefault = False TabOrder = 0 object Layout2: TLayout Align = Top Padding.Left = 20.000000000000000000 Padding.Top = 20.000000000000000000 Padding.Right = 20.000000000000000000 Padding.Bottom = 20.000000000000000000 Size.Width = 424.000000000000000000 Size.Height = 81.000000000000000000 Size.PlatformDefault = False TabOrder = 3 object btnClickMe: TButton Align = Left Position.X = 20.000000000000000000 Position.Y = 20.000000000000000000 Size.Width = 160.000000000000000000 Size.Height = 41.000000000000000000 Size.PlatformDefault = False TabOrder = 0 Text = 'btnClickMe' end object Button1: TButton Align = Right Position.X = 244.000000000000000000 Position.Y = 20.000000000000000000 Size.Width = 160.000000000000000000 Size.Height = 41.000000000000000000 Size.PlatformDefault = False TabOrder = 1 Text = 'Button1' end end object Layout3: TLayout Align = Top Padding.Left = 20.000000000000000000 Padding.Top = 20.000000000000000000 Padding.Right = 20.000000000000000000 Padding.Bottom = 20.000000000000000000 Position.Y = 81.000000000000000000 Size.Width = 424.000000000000000000 Size.Height = 81.000000000000000000 Size.PlatformDefault = False TabOrder = 2 object Label1: TLabel Align = Center AutoSize = True StyledSettings = [Family, FontColor] Size.Width = 129.000000000000000000 Size.Height = 32.000000000000000000 Size.PlatformDefault = False TextSettings.Font.Size = 24.000000000000000000 TextSettings.Font.StyleExt = {00070000000000000004000000} Text = 'Label1' TabOrder = 0 end end object Layout4: TLayout Align = Client Size.Width = 424.000000000000000000 Size.Height = 446.000000000000000000 Size.PlatformDefault = False TabOrder = 1 object btnExit: TButton Align = Center Size.Width = 145.000000000000000000 Size.Height = 217.000000000000000000 Size.PlatformDefault = False TabOrder = 0 Text = 'btnExit' end end end end hug Edited January 2, 2021 by Guest Share this post Link to post