2016년 11월 22일 화요일

Screen widths and heights


Has anybody else had issued with the screen height and widths being back to front?

When changing the screen orientation I've noticed the screen.height and screen.width values appear to be back to front. I'm not sure if it's an issue in my code, my phone or the appinventor code. 


Attached is a sample code. I would have thought that that would mean that 
If landscape - make the canvas height the screen size and the width a ratio of height
else portrait - make canvas width of screen and height a ratio of width 

I've also got a different title for portrait and landscape so I know when it's in portrait mode and landscape mode. For some reason it selects the portrait title when it's in landscape mode and vice versa and all my canvas sizes, appart from the initial load are messed up.

-- 
I think, this is a timing issue
after changing the orientation, try to call that procedure some milliseconds later to get the correct values
you can use a clock component for that
Taifun

-- 
Great that was it. Just had to add a timer. Thanks!

-- 

댓글 없음:

댓글 쓰기