Jump to content
Sign in to follow this  
amit

FMX Display Problem on Galaxy Note 5

Recommended Posts

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.

 

image.thumb.png.5c81dfcb31ee73ffa64e0357fbeec34e.pngScreenshot_20210101-100709.thumb.png.243e48475412e87bef8451c6c826f567.png

 

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

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?

 

image.thumb.png.49ee4efab43d3c7474849331d4b7f0b4.png   image.thumb.png.723c9f413c1af6fa140ebd362c7ccfd4.png

 

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 by Guest

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×