Declarative UI
You have several ways to deal with platform specifics in your Declarative UI files. We will look at each way and examine the pros and cons of each method.
Declarative UI properties
The first way is for properties. You can use the following line of code:
<Button ios:text="iOS is Awesome" android:text="Android is Awesome"/>
As you can see, we prefixed the text property with a ios:
or android:
prefix, so on their respective platforms, they will declare that the platform is Awesome
. If you only have a couple of properties to change, this is the easiest method to use and maintain. It does not allow you to change any platform-specific components though. If you have a lot of platform-specific properties or you need to use a different component on the platforms, then you will need to use Declarative UI platform qualifiers.
Declarative UI platform qualifiers
A Declarative UI platform qualifier allows you to qualify a whole group of components or properties to a specific platform like...