Titanium Community Questions & Answer Archive

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

Android image resolution folders

The docs say to create high/med/low directories within the PROJECT/Resources/android/images folder. I just created a new Titanium project using the 1.6 branch of the SDK and I got these folders:

res-long-land-hdpi 
res-long-land-ldpi
res-long-port-hdpi
res-long-port-ldpi
res-notlong-land-hdpi 
res-notlong-land-ldpi
res-notlong-land-mdpi
res-notlong-port-hdpi
res-notlong-port-ldpi
res-notlong-port-mdpi

So I can guess the land/port differences and the Android dev docs explain the ldpi/mdpi/hdpi (low/med/high) differences. But, what's the difference between long and notlong. And there aren't long-port-mdpi and long-land-mdpi directories…can I or should I create them if I need medium res images?

— asked January 21st 2011 by Tim Poulsen
  • android
  • images
  • resolution
0 Comments

6 Answers

  • Accepted Answer

    I read http://developer.android.com/guide/practices/screens_support.html a bit more and found the answer … long and notlong refer to the aspect ratio. So, long is for "screens of any size or density that have a significantly taller (in portrait mode) and wider (in landscape mode) aspect ratio than the baseline screen configuration." And notlong is the opposite.

    — answered January 23rd 2011 by Tim Poulsen
    permalink
    0 Comments
  • Are there any guidelines for what to do for a tablet-sized (1280x800) image? Whatever folder/naming convention I use, it just seems to be stretching a smaller image instead.

    — answered May 24th 2011 by K T
    permalink
    0 Comments
  • Not having a tablet to test with, I'm going to have to take an educated guess. Looking at http://developer.android.com/guide/practices/screens-distribution.html and http://developer.android.com/guide/topics/resources/providing-resources.html I believe you'll need to create a pair of directories: res-notlong-port-xhdpi and res-notlong-land-xhdpi and put your specific resources in there (e.g. splash screens). I think you'll need to add the <compatible-screens> and/or <supports-screens> tags to your AndroidManifest as described in the first link above.

    Of course, once you test this and find the actual answer, please post back here so we'll all learn!

    — answered May 24th 2011 by Tim Poulsen
    permalink
    0 Comments
  • I'm wondering the same thing, can anyone enlighten us? :)

    — answered January 22nd 2011 by Vebjørn Berg
    permalink
    2 Comments
    • I'm with him ^^^

      I just took my Appicon and converted it to be the same sizes as the images in those folders, then added "anyDensity='true'" to my tiapp.xml like the console told me.

      — commented January 22nd 2011 by Colton Arabsky
    • so adding:

          <android xmlns:android="http://schemas.android.com/apk/res/android">
              <manifest>
                  <supports-screens android:anyDensity="true"/>
              </manifest>
          </android>
      

      would render images on that folder?

      In my case I used multiple background for my apps, how do I included them for diff resolution?

      — commented September 3rd 2011 by Peter Eman Abastillas
  • I tried this and could not get past the build stage:

    [TRACE] Writing out AndroidManifest.xml
    [DEBUG] /Users/jchavez/Projects/izenme/Development/ext/android/android-sdk-mac_x86/platforms/android-7/tools/aapt package -m -J /Users/jchavez/Projects/AlertId/projects/AlertID/root/trunk/build/android/gen -M /Users/jchavez/Projects/AlertId/projects/AlertID/root/trunk/build/android/AndroidManifest.xml -S /Users/jchavez/Projects/AlertId/projects/AlertID/root/trunk/build/android/res -I /Users/jchavez/Projects/izenme/Development/ext/android/android-sdk-mac_x86/platforms/android-7/android.jar
    [ERROR] Error generating R.java from manifest
    [ERROR] invalid resource directory name: /Users/jchavez/Projects/AlertId/projects/AlertID/root/trunk/build/android/res/drawable-notlong-xhdpi

    — answered June 15th 2011 by Joe Chavez
    permalink
    2 Comments
    • You're using the android SDK level 7 tooling and the property you're trying to use is level 8. From the docs.

      xhdpi: Extra high-density screens; approximately 320dpi. Added in API Level 8
      

      — commented June 15th 2011 by Don Thorp
    • Yes, this makes sense… thank you for the quick response!

      — commented June 15th 2011 by Joe Chavez
  • It does not help that TiSDK on Android selects images in the wrong order.

    https://jira.appcelerator.org/browse/TC-1168

    — answered August 15th 2012 by Esben Maaløe
    permalink
    0 Comments
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.