1

How do I configure a Xamarin.Forms app to fill out phones with newer aspect ratios like the Samsung Galaxy S8?

Currently my Xamarin.Forms app looks like the one on the left below. What configuration do I need to change?

enter image description here

Null Reference
  • 11,260
  • 40
  • 107
  • 184

1 Answers1

2

Initially, I thought this might have been an issue with Xamarin. However, after further research I found it to be a new configuration for Android apps in general to support the 18:9 aspect ratio.

Here is the Android Developers Blog post describing the updates:

In order to take full advantage of the larger display formats on these devices, you should consider increasing your app's maximum supported aspect ratio. To do so, simply declare an android.max_aspect <meta-data> element in the app's <application> element:

<meta-data android:name="android.max_aspect" android:value="2.1" />

This resolved the issue for me. Related answer here.

Taylor Buchanan
  • 4,155
  • 1
  • 28
  • 40
  • I'm confused, I've created an emulator AVD with 18:9 aspect ratio to try and test the issue but my app seems to expand to the full length even before I've added the android.max_aspect. Does this apply to emulators? Is there a way I can test to see the problem first before seeing that `android.max_aspect` fixes the problem? – Thibault D. Jul 28 '17 at 13:40
  • @ThibaultD. I'm not sure. I own a Samsung Galaxy S4 and S8 so I am able to test the scenario on physical devices. – Taylor Buchanan Jul 28 '17 at 15:34