Hello everybody ! I'm just a new user of Titanium Studio, and I'm currently learning how to develop on Android. More, I'm sorry for my bad English (because I'm French !), and I hope I will be clear.
So, I just want to create a simple app, where I will display a penguin at the middle of the device screen. I want do to that for every kind of Android phone (for the moment). My objective in the future, is to create a similar app to "Flappy Bird".
I give you my code :
var screenHeight = Ti.Platform.displayCaps.platformHeight; var screenWidth = Ti.Platform.displayCaps.platformWidth; var win = Titanium.UI.createWindow({ backgroundColor:'#fff', backgroundImage: 'images/background.jpg', orientationModes: [ Titanium.UI.PORTRAIT ], // UI restricted to portrait mode fullscreen: true, exitOnClose: true, navBarHidden: true }); var penguin= Titanium.UI.createImageView({ image: 'images/penguin.gif', bottom: screenHeight/2, left: screenWidth/2 }); win.add(penguin); win.open();
But with that code, my penguin is not on the device screen ! My background.jpg is 207x405 px and my penguin.gif is 45x35 px. Can you help me ? Thanks !