Most people have probably already seen this but in case you missed it in September 2013 Embarcadero released a set of premium styles for Delphi XE5. The styles come in two colors which are Jet and Diamond. There is a style included for each of the supported OSes which are Android, IOS, OSX, and Windows. What I do with my mobile apps is put a TStyleBook on the form, assign it to the form StyleBook property, double click it to bring up the style editor, and then pick the style for the OS that I am currently compiling against. You can also do it via code but for testing purposes this was the fastest way for me. Apparently the Firemonkey styles have support for the different resolutions provided by devices with Retina resolution displays. The style pack should really just come with Delphi XE5 when you install it but maybe it will be integrated with the next version.
Head over and check out the full blog post and then download your premium style pack.
I have tried to use the styles as shown on the page: http://docwiki.embarcadero.com/RADStudio/XE5/en/Working_with_Native_and_Custom_FireMonkey_Styles
using the “Loading Custom Styles to Support Multiple Platforms in One Application” code. When I run my app on android the app crashes at the line:
Style := TStyleManager.LoadFromResource(HInstance, ‘AndroidJet’, RT_RCDATA);
I have double checked and the resource name is correct and the style is present in the res and rc file. Just not working as expected. Any ideas?
Yeah I wrote code like that too to load the right style for the correct platform and I think it crashed on me as well. I ended up just loading the style into the style book for the platform I am compiling for at design time. However, I was able to have multiple style books in my IOS app and switch between the Diamond and Jet styles at runtime using multiple stylebook components.
Here is what I found after some trial and error. Turns out I was trying to set the style too soon in the application start up. I was calling this code before “Application.Run”. This seems to be a no no. So, I moved the call to the first form “Show”. No other code changes and we now have styles! Hope this helps others using the FM styles. BTW: This was not a issue compiling for Windows.
Correction: I moved the call to the first TForm.Create not Show.
.