如何更改Mobile,Delphi Sydney 10.4 FMX中的listView ttextObjectAppearance字体?

发布于 2025-01-21 12:43:30 字数 7480 浏览 0 评论 0原文

我想更改listView ttextobjectAppearance中的默认字体,当我在Windows上运行它时,它可以正常工作,但是当我运行移动设备时,它不会显示我选择的字体。

.fmx

object Form1: TForm1
  Left = 0
  Top = 0
  Caption = 'Form1'
  ClientHeight = 480
  ClientWidth = 321
  FormFactor.Width = 320
  FormFactor.Height = 480
  FormFactor.Devices = [Desktop]
  DesignerMasterStyle = 0
  object DomainsListView: TListView
    ItemAppearanceClassName = 'TDynamicAppearance'
    ItemEditAppearanceClassName = 'TDynamicAppearance'
    HeaderAppearanceClassName = 'TListHeaderObjects'
    FooterAppearanceClassName = 'TListHeaderObjects'
    Align = Client
    Size.Width = 321.000000000000000000
    Size.Height = 480.000000000000000000
    Size.PlatformDefault = False
    TabOrder = 1
    ItemAppearance.ItemHeight = 58
    ItemAppearanceObjects.ItemObjects.ObjectsCollection = <
      item
        AppearanceObjectName = 'domain'
        AppearanceClassName = 'TTextObjectAppearance'
        Appearance.Font.Family = 'Algerian'
        Appearance.Font.Size = 19.000000000000000000
        Appearance.Font.StyleExt = {00070000000000000004000000}
        Appearance.TextAlign = Leading
        Appearance.WordWrap = True
        Appearance.TextColor = claNavy
        Appearance.Trimming = Word
        Appearance.Width = 209.000000000000000000
        Appearance.Height = 29.000000000000000000
        Appearance.Align = Center
        Appearance.VertAlign = Center
        Appearance.PlaceOffset.X = 7.000000000000000000
        Appearance.PlaceOffset.Y = -12.000000000000000000
      end
      item
        AppearanceObjectName = 'expiry'
        AppearanceClassName = 'TTextObjectAppearance'
        Appearance.Font.Family = 'Algerian'
        Appearance.Font.Size = 17.000000000000000000
        Appearance.TextAlign = Leading
        Appearance.TextColor = xFFF1490B
        Appearance.Width = 209.000000000000000000
        Appearance.Height = 24.000000000000000000
        Appearance.Align = Center
        Appearance.VertAlign = Center
        Appearance.PlaceOffset.X = 8.000000000000000000
        Appearance.PlaceOffset.Y = 14.000000000000000000
      end
      item
        AppearanceObjectName = 'image'
        AppearanceClassName = 'TImageObjectAppearance'
        Appearance.Width = 31.000000000000000000
        Appearance.Height = 32.000000000000000000
        Appearance.PlaceOffset.X = 8.000000000000000000
        Appearance.PlaceOffset.Y = 16.000000000000000000
      end>
    ItemAppearanceObjects.ItemEditObjects.ObjectsCollection = <
      item
        AppearanceObjectName = 'Text1'
        AppearanceClassName = 'TTextObjectAppearance'
      end>
    ItemAppearanceObjects.FooterObjects.Text.Width = 233.000000000000000000
    ItemAppearanceObjects.FooterObjects.Text.Height = 24.000000000000000000
    ItemAppearanceObjects.FooterObjects.Text.PlaceOffset.X = 80.000000000000000000
    StyleLookup = 'DomainsListViewStyle1'
    object FilterPanelRect: TRectangle
      Align = Client
      Fill.Color = xFF2AB39C
      Margins.Left = 25.000000000000000000
      Margins.Top = 8.000000000000000000
      Margins.Right = 25.000000000000000000
      Margins.Bottom = 100.000000000000000000
      Size.Width = 300.000000000000000000
      Size.Height = 407.000000000000000000
      Size.PlatformDefault = False
      Stroke.Color = xFF23917E
      Stroke.Thickness = 5.000000000000000000
      Visible = False
      object HeaderFilterPanelRect: TRectangle
        Align = Top
        Fill.Color = xFF2B2A38
        Size.Width = 300.000000000000000000
        Size.Height = 41.000000000000000000
        Size.PlatformDefault = False
        Stroke.Kind = None
        object HeaderFilterPanelLabel: TLabel
          Align = Client
          StyledSettings = [Family, Style]
          Margins.Left = 5.000000000000000000
          Margins.Top = 5.000000000000000000
          Margins.Right = 5.000000000000000000
          Margins.Bottom = 5.000000000000000000
          Size.Width = 290.000000000000000000
          Size.Height = 31.000000000000000000
          Size.PlatformDefault = False
          StyleLookup = 'toollabel'
          TextSettings.Font.Size = 18.000000000000000000
          TextSettings.FontColor = claWhite
          TextSettings.HorzAlign = Center
          Text = 'Select Filter'
          TabOrder = 0
        end
      end
    end
    object Edit1: TEdit
      Touch.InteractiveGestures = [LongTap, DoubleTap]
      TabOrder = 1
      Position.X = 144.000000000000000000
      Position.Y = 352.000000000000000000
      Size.Width = 185.000000000000000000
      Size.Height = 30.000000000000000000
      Size.PlatformDefault = False
      Visible = False
    end
    object Edit2: TEdit
      Touch.InteractiveGestures = [LongTap, DoubleTap]
      TabOrder = 2
      Position.X = 144.000000000000000000
      Position.Y = 384.000000000000000000
      Size.Width = 185.000000000000000000
      Size.Height = 30.000000000000000000
      Size.PlatformDefault = False
      Visible = False
    end
    object Edit3: TEdit
      Touch.InteractiveGestures = [LongTap, DoubleTap]
      TabOrder = 3
      Position.X = 144.000000000000000000
      Position.Y = 416.000000000000000000
      Size.Width = 185.000000000000000000
      Size.Height = 30.000000000000000000
      Size.PlatformDefault = False
      Visible = False
    end
    object Edit4: TEdit
      Touch.InteractiveGestures = [LongTap, DoubleTap]
      TabOrder = 4
      Position.X = 144.000000000000000000
      Position.Y = 448.000000000000000000
      Size.Width = 185.000000000000000000
      Size.Height = 30.000000000000000000
      Size.PlatformDefault = False
      Visible = False
    end
    object StringGrid1: TStringGrid
      Align = Client
      CanFocus = True
      ClipChildren = True
      Size.Width = 350.000000000000000000
      Size.Height = 520.000000000000000000
      Size.PlatformDefault = False
      TabOrder = 7
      Visible = False
      RowCount = 0
      Viewport.Width = 346.000000000000000000
      Viewport.Height = 495.000000000000000000
    end
    object Button1: TButton
      Position.X = 224.000000000000000000
      Position.Y = 248.000000000000000000
      TabOrder = 8
      Text = 'Button1'
      OnClick = Button1Click
    end
  end
end

。pas

unit Unit1;

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
  FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs,
  FMX.ListView.Types, FMX.ListView.Appearances, FMX.ListView.Adapters.Base,
  System.Rtti, FMX.Grid.Style, FMX.ScrollBox, FMX.Grid, FMX.Edit,
  FMX.Controls.Presentation, FMX.StdCtrls, FMX.Objects, FMX.ListView;

type
  TForm1 = class(TForm)
    DomainsListView: TListView;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.fmx}

procedure TForm1.Button1Click(Sender: TObject);
var
  LItem: TListViewItem;
   begin
     LItem := DomainsListView.Items.Add;
      LItem.Data['domain'] := 'Stackoverflow.com';
      LItem.Data['expiry'] := datetimetostr(now);
   end;
end.

我已经更新了帖子,我添加了.pas和.fmx文件的代码。

I want to change the default Font in Listview TTextObjectAppearance, when I run it on windows it works fine but when I run it mobile it does not show the Font I select.

.fmx

object Form1: TForm1
  Left = 0
  Top = 0
  Caption = 'Form1'
  ClientHeight = 480
  ClientWidth = 321
  FormFactor.Width = 320
  FormFactor.Height = 480
  FormFactor.Devices = [Desktop]
  DesignerMasterStyle = 0
  object DomainsListView: TListView
    ItemAppearanceClassName = 'TDynamicAppearance'
    ItemEditAppearanceClassName = 'TDynamicAppearance'
    HeaderAppearanceClassName = 'TListHeaderObjects'
    FooterAppearanceClassName = 'TListHeaderObjects'
    Align = Client
    Size.Width = 321.000000000000000000
    Size.Height = 480.000000000000000000
    Size.PlatformDefault = False
    TabOrder = 1
    ItemAppearance.ItemHeight = 58
    ItemAppearanceObjects.ItemObjects.ObjectsCollection = <
      item
        AppearanceObjectName = 'domain'
        AppearanceClassName = 'TTextObjectAppearance'
        Appearance.Font.Family = 'Algerian'
        Appearance.Font.Size = 19.000000000000000000
        Appearance.Font.StyleExt = {00070000000000000004000000}
        Appearance.TextAlign = Leading
        Appearance.WordWrap = True
        Appearance.TextColor = claNavy
        Appearance.Trimming = Word
        Appearance.Width = 209.000000000000000000
        Appearance.Height = 29.000000000000000000
        Appearance.Align = Center
        Appearance.VertAlign = Center
        Appearance.PlaceOffset.X = 7.000000000000000000
        Appearance.PlaceOffset.Y = -12.000000000000000000
      end
      item
        AppearanceObjectName = 'expiry'
        AppearanceClassName = 'TTextObjectAppearance'
        Appearance.Font.Family = 'Algerian'
        Appearance.Font.Size = 17.000000000000000000
        Appearance.TextAlign = Leading
        Appearance.TextColor = xFFF1490B
        Appearance.Width = 209.000000000000000000
        Appearance.Height = 24.000000000000000000
        Appearance.Align = Center
        Appearance.VertAlign = Center
        Appearance.PlaceOffset.X = 8.000000000000000000
        Appearance.PlaceOffset.Y = 14.000000000000000000
      end
      item
        AppearanceObjectName = 'image'
        AppearanceClassName = 'TImageObjectAppearance'
        Appearance.Width = 31.000000000000000000
        Appearance.Height = 32.000000000000000000
        Appearance.PlaceOffset.X = 8.000000000000000000
        Appearance.PlaceOffset.Y = 16.000000000000000000
      end>
    ItemAppearanceObjects.ItemEditObjects.ObjectsCollection = <
      item
        AppearanceObjectName = 'Text1'
        AppearanceClassName = 'TTextObjectAppearance'
      end>
    ItemAppearanceObjects.FooterObjects.Text.Width = 233.000000000000000000
    ItemAppearanceObjects.FooterObjects.Text.Height = 24.000000000000000000
    ItemAppearanceObjects.FooterObjects.Text.PlaceOffset.X = 80.000000000000000000
    StyleLookup = 'DomainsListViewStyle1'
    object FilterPanelRect: TRectangle
      Align = Client
      Fill.Color = xFF2AB39C
      Margins.Left = 25.000000000000000000
      Margins.Top = 8.000000000000000000
      Margins.Right = 25.000000000000000000
      Margins.Bottom = 100.000000000000000000
      Size.Width = 300.000000000000000000
      Size.Height = 407.000000000000000000
      Size.PlatformDefault = False
      Stroke.Color = xFF23917E
      Stroke.Thickness = 5.000000000000000000
      Visible = False
      object HeaderFilterPanelRect: TRectangle
        Align = Top
        Fill.Color = xFF2B2A38
        Size.Width = 300.000000000000000000
        Size.Height = 41.000000000000000000
        Size.PlatformDefault = False
        Stroke.Kind = None
        object HeaderFilterPanelLabel: TLabel
          Align = Client
          StyledSettings = [Family, Style]
          Margins.Left = 5.000000000000000000
          Margins.Top = 5.000000000000000000
          Margins.Right = 5.000000000000000000
          Margins.Bottom = 5.000000000000000000
          Size.Width = 290.000000000000000000
          Size.Height = 31.000000000000000000
          Size.PlatformDefault = False
          StyleLookup = 'toollabel'
          TextSettings.Font.Size = 18.000000000000000000
          TextSettings.FontColor = claWhite
          TextSettings.HorzAlign = Center
          Text = 'Select Filter'
          TabOrder = 0
        end
      end
    end
    object Edit1: TEdit
      Touch.InteractiveGestures = [LongTap, DoubleTap]
      TabOrder = 1
      Position.X = 144.000000000000000000
      Position.Y = 352.000000000000000000
      Size.Width = 185.000000000000000000
      Size.Height = 30.000000000000000000
      Size.PlatformDefault = False
      Visible = False
    end
    object Edit2: TEdit
      Touch.InteractiveGestures = [LongTap, DoubleTap]
      TabOrder = 2
      Position.X = 144.000000000000000000
      Position.Y = 384.000000000000000000
      Size.Width = 185.000000000000000000
      Size.Height = 30.000000000000000000
      Size.PlatformDefault = False
      Visible = False
    end
    object Edit3: TEdit
      Touch.InteractiveGestures = [LongTap, DoubleTap]
      TabOrder = 3
      Position.X = 144.000000000000000000
      Position.Y = 416.000000000000000000
      Size.Width = 185.000000000000000000
      Size.Height = 30.000000000000000000
      Size.PlatformDefault = False
      Visible = False
    end
    object Edit4: TEdit
      Touch.InteractiveGestures = [LongTap, DoubleTap]
      TabOrder = 4
      Position.X = 144.000000000000000000
      Position.Y = 448.000000000000000000
      Size.Width = 185.000000000000000000
      Size.Height = 30.000000000000000000
      Size.PlatformDefault = False
      Visible = False
    end
    object StringGrid1: TStringGrid
      Align = Client
      CanFocus = True
      ClipChildren = True
      Size.Width = 350.000000000000000000
      Size.Height = 520.000000000000000000
      Size.PlatformDefault = False
      TabOrder = 7
      Visible = False
      RowCount = 0
      Viewport.Width = 346.000000000000000000
      Viewport.Height = 495.000000000000000000
    end
    object Button1: TButton
      Position.X = 224.000000000000000000
      Position.Y = 248.000000000000000000
      TabOrder = 8
      Text = 'Button1'
      OnClick = Button1Click
    end
  end
end

.pas

unit Unit1;

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
  FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs,
  FMX.ListView.Types, FMX.ListView.Appearances, FMX.ListView.Adapters.Base,
  System.Rtti, FMX.Grid.Style, FMX.ScrollBox, FMX.Grid, FMX.Edit,
  FMX.Controls.Presentation, FMX.StdCtrls, FMX.Objects, FMX.ListView;

type
  TForm1 = class(TForm)
    DomainsListView: TListView;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.fmx}

procedure TForm1.Button1Click(Sender: TObject);
var
  LItem: TListViewItem;
   begin
     LItem := DomainsListView.Items.Add;
      LItem.Data['domain'] := 'Stackoverflow.com';
      LItem.Data['expiry'] := datetimetostr(now);
   end;
end.

I have updated the post and I have added the code of the .pas and .fmx files.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文