yangyxd / FMXUI

FMX跨平台基础UI库
MIT License
261 stars 96 forks source link

TDialogBuilder -> SetItems -> FontSize Items #52

Closed marlonnardi closed 1 year ago

marlonnardi commented 1 year ago

How do I access the FontSize property when adding Items to the List?

image

image

image

marlonnardi commented 1 year ago

@KngStr Is there a possibility to implement this?

KngStr commented 1 year ago

You can do this by custom adapter


{ TCustomStringsListAdapter }

function TCustomStringsListAdapter.GetView(const Index: Integer;
  ConvertView: TViewBase; Parent: TViewGroup): TViewBase;
begin
  Result := inherited GetView(Index, ConvertView, Parent);
  if (ConvertView = nil) or (not (ConvertView is TListTextItem)) then begin
    TListTextItem(Result).Gravity := TLayoutGravity.Center;
    TListTextItem(Result).TextSettings.Font.Size := 30;
  end;
end;

Test unit :FMXUI\demos\standard\uFrameDialog.pas. ButtonView20Click

marlonnardi commented 1 year ago

Perfect, it worked, thanks again.