0

I've started using Xamarin Forms.

For styling, it's recommended that you use resource dictionaries for providing values.

My question is, what's the best approach if you need to supply different styles per DPI in Xamarin Forms?

Regards,

Steve

Stephen Hewison
  • 324
  • 2
  • 9
  • This kind of styling, especially handling different DPIs, is handled in the actual platform projects. So in the iOS project you would add the 2x, 3x naming convention to your images and in Android you would put your images in the appropriate drawable-[size] folders. Check out the appropriate documentation for each platform @ https://developer.xamarin.com/guides/ios/application_fundamentals/working_with_resources/ and https://developer.xamarin.com/guides/android/application_fundamentals/resources_in_android/ – Steven Thewissen May 11 '17 at 09:45
  • Thanks for your reply. I understand the principle around assets such as images. But how about text size? What if I want to increase the text size for higher dpi devices? – Stephen Hewison May 11 '17 at 10:16
  • For things like that I believe Xamarin Forms simply sends it on to the specific OS. It doesn't append any specific unit. There it will transform that value into dp in Android and pts in iOS. As far as I know a FontSize of 12 gets calculated into the equivalent for each density. If you want to make styling choices based on density you're probably going to need to make use of custom renderers. – Steven Thewissen May 11 '17 at 10:57

0 Answers0