简体   繁体   中英

Custom styles in mobile FireMonkey

Used: Appmethod 1.14

I need to design an application with a custom style. Placing a TStyleBook on the form and double-clicking it opens the Style Designer but it is empty, so I need to load one of the *.fsf or *.style files shipped with Appmethod / RAD Studio. I would like to make a design based on the standard Android and iOS design (the ones that are used in the IDE if no custom style applied), but where do I find the style files? My problem: There is an "AndroidLight.fsf" file which looks exactly like the default (hard coded?) Android design in the IDE. I can modify it and it works in Android. This is nice. But I can't use the same style for iOS (I need to use one single style for Android and iOS), because the App just freezes (if I use a TStyleBook) or shows me an error that the style cannot be loaded from resource (if I add it as a resource and load from there):

procedure TUserDataForm.FormCreate(Sender: TObject);
var
  Style: TFMXObject;
begin
  MainScroll := VertScrollBox1;

  {$IFDEF Android}
    // works
    Style := TStyleManager.LoadFromResource(HInstance, 'DSRAndroidIOS', RT_RCDATA);
  {$ENDIF}
  {$IFDEF iOS}
    // Can't load same style file
    Style := TStyleManager.LoadFromResource(HInstance, 'DSRAndroidIOS', RT_RCDATA);
  {$ENDIF}
  if Style <> nil then
    TStyleManager.SetStyle(Style);
end;

And I couldn't find any other *.style or *.fsf file shipped with Appmethod / RAD Studio, which looks like the standard iOS 7 design in the IDE. I could try to start adding my own style-sections in the Style Designed, but how do I know which names to use and how the style hirarchy is structured? Is there an overview some where?

I found 6 files without a file extension in the folder "C:\\Program Files (x86)\\Embarcadero\\Studio\\14.0\\bin\\ios\\". They seem to be binary style files (opened with a Hex editor) but I can't load them in the StyleDesiger, error: "Error reading TSubImage.SourceRect.LeftI: Property SourceRect.LeftI does not exists" (or similar - translated from german).

Edit: Ok, I have the styles now. I extracted them myself from a compiled mobile FireMonkey project with iOS as target platform. Used an hex editor for that. But I would like to know if the styles are stored somewhere else maybe?

You can get the original styles via the Bitmap Style Designer that is bundled with Delphi. You'll find the link on the Tools menu in the IDE.

Once opened click the dropdown next the the File Open icon. You'll see the available styles listed. Click one to open, then select File|Save As and select Save as type: FireMonkey Style.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM