I made an application with screen aspect ratio lock turned off. (https://powerapps.microsoft.com/hu-hu/tutorials/set-aspect-ratio-portrait-landscape/)
I tried to make a header image with the screen width and calculate the height, based on image original aspect ratio.
Image1.Width = Screen1.Width
Image1.Height = Round(Image1.Width * (Image1.OriginalHeight/Image1.OriginalWidth); 0)
Image1.CalculateOriginalDimensions = true
Image1.ImagePosition = ImagePosition.Fit
The image width is ok, it is as wide as the screen.
But, the Screen1.Width is always equal to 640, so the calculated height is always the same value.
If i put the Screen1.Width and Screen1.Height into textbox, it displays 640x1136 always (9:16). I have an Nexus5 phone, screen size: 1080x1776 (9.7:16).
Could someone help me?
The default phone size for PowerApps is 640x1136. From the article you has provided, we know that If we unlock the aspect ratio, the app will adjust to the aspect ratio of the device on which it's running.
On your Nexus5 phone how is the image displayed? Could you show me a screenshot?
As I don’t have a Nexus5 phone, I test this issue on my iPhone6. I create the App on PowerApps studio according to your description, then I open it on my phone. The Screen1.Width and Screen1.Height value shown in the Textbox is the default size.
here is the screenshot from my phone.
my header image is the green box bordered with black line, the red color is the background of the image
my expectation is: no red color is visible,
if the width is 640 the height must be 1054 (becaue of aspect ratio of Nexus5)
1136/1054 * 200 = 215.56
So i tried to set 215.56 as height for image, and the result was i expected, no visible red background on Nexus5 (ofc the red background appeared on 9:16 screen now)
so i think if i set 200, it is realy recalculated to 185.56, 215.56 recalculated to 200, which is the good height for image if the width is 640. This recalculating based on default screen height and the real height aspect ratio, and the screen width normaized to 640.
It would be good for me, if i know the aspect ratio of the current screen.
So, the topic name should change to "the Screen.Height is always 1136"
Thanks for your reply. It seems that this issue has been solved.
If you have any other issues when using PowerApps, please feel free submit on this forum.
Fill out a quick form to claim your user group badge now!
Find out where you can attend!
Features releasing from October 2019 through March 2020
The largest Power BI, Power Platform, and Data conference in New Zealand