Quantcast
Channel: Appcelerator Developer Center Q&A Tag Feed (device)
Viewing all articles
Browse latest Browse all 250

How to get the device screen size ?

$
0
0

Hello everybody ! I'm here because I've got a problem. I want to get the device screen height and width. I've tried

screenHeight = Ti.Platform.displayCaps.platformHeight;
screenWidth = Ti.Platform.displayCaps.platformWidth;
I work with a Samsung Galaxy S5, and when I do that, it returns me 1080*1920. But, when I try to move an image like this :
if(image.bottom < screenHeight)
//move the image
it doesn't work !

I'm just trying to make a Flappy Bird, and I can't do it because of this problem. My bird can always exit ofthe screen. More, I need to adapt my code for each type of Android phone (and IOS next). Can somebody help me ?

Thanks a lot.


Viewing all articles
Browse latest Browse all 250

Latest Images

Trending Articles





Latest Images