Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Of graphics and best practice

Hi there

Are there any guidelines/recommendations about graphic content with respect to format, DPI/PPI etc when developing for multiple platforms (ie iPhone and Android).

Obviously I would like my apps to look the same from one to the next, however I have noticed that my images and graphics never look as good on the Android as they do on the iPhone.

I realise that there are different screen sizes to contend with (why isnt there a variable that returns the current display size so you can center labels and things? ). I realise that I could probably do this through a webview with a JSEval and put it in a Titanium.App.Properties.setInt field so that I can use it as a global var… but all that seems a bit naff!

Open to all recommendations and suggestions :)

— asked March 23rd 2010 by Gregor Munro
  • android
  • images
  • iphone
  • mobile
0 Comments

2 Answers

  • As I understand Titanium so far, you need to define the sizes of your gui in (for example) inches. Then, you can get the dpi value and transform the sizes to pixel, in respect to the screen of the device.

    For the pictures, I think, you have to put each pictures in the various directories, one for every screen format… Tell me if I am wrong.

    — answered August 25th 2011 by Charalampos Chrysikopoulos
    permalink
    0 Comments
  • I think these are what you are looking for:

    w=Titanium.Platform.displayCaps.platformWidth;
    h=Titanium.Platform.displayCaps.platformHeight;
    d=Titanium.Platform.displayCaps.density;
    dpi=Titanium.Platform.displayCaps.dpi;
    

    I know they don't answer your original questions but they may help.

    — answered March 23rd 2010 by General Usage
    permalink
    1 Comment
    • So if I want to grab something like platformWidth but in dp instead of pixels, how would I do that?

      — commented April 21st 2012 by Christopher Pierick
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.