Titanium Community Questions & Answer Archive

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

Multi-resolution splash screen on Android

Someone can help me understand how I can change splash screen for Android in multiresolution?

How I should set it to make it working both with landscape and portrait?

How I should set it to make it working with different resolutions?

Thanks!

— asked July 5th 2011 by Libero Rignanese
  • android
  • landscape
  • portrait
  • resolution
  • splash
0 Comments

4 Answers

  • Accepted Answer

    My best advice would be to create a new project using Studio (or Developer, both work in this case). This will create the following directories under Resources/android/images.

    • 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

    From there, you can simply update the splash screens you want depending on the resolution you want. Here is a more technical explanation from the Android site of what each mode does.

    — answered July 5th 2011 by Christian Brousseau
    permalink
    10 Comments
    • It works well!

      — commented July 6th 2011 by Libero Rignanese
    • Hi - I have used these directories and works well on MOST devices, but the Droid X has an extra long screen so the splash image is stretched. Being that this is the most commonly used device for the apps developed at my company, this is a BIG problem! I tried using an xlong directory but no luck. Could anyone advise on how to address this? Thanks in advance!

      — commented July 25th 2012 by Amy H
    • Amy, did you put a 480x800 splash screen in the res-long-port-hdpi directory? If so, what are the dimensions of a Droid X screen?

      — commented July 25th 2012 by Shawn Lipscomb
    • Hi Shawn, I did put a 480x800 in the res-long-port-hdpi directory. The Droid screen is 480 x 854

      — commented July 25th 2012 by Amy H
    • Untested: I saw a reference to res-HHHxWWW (the larger pixel dimension coming first…e.g. drawable-800x480 and drawable-854x480). You might try that.

      — commented July 25th 2012 by Shawn Lipscomb
    • Thanks for the suggestion - tried it but unfortunately it did not use the splash screen inserted in that folder. Perhaps the high port overrides it, because I also did not receive an error on the directory itself. I will try renaming both directories… Of course this might cause problems on screens that are high dpi but different size, right?

      — commented July 25th 2012 by Amy H
    • Yes, Android will find the next best match and use that image, resizing it if necessary.

      — commented July 25th 2012 by Shawn Lipscomb
    • Haha! I figured it out… screen size is the least prioritized item so I had to create a folder named "res-long-port-hdpi-854x480". This worked. "res-854x480" does not work because it is deprioritized next to folders that define the long, port, or hdpi. This documentation was helpful but not comprehensive: http://developer.android.com/guide/topics/resources/providing-resources.html#BestMatch

      — commented July 25th 2012 by Amy H
    • thanks Shawn, for putting me in the right direction!

      — commented July 25th 2012 by Amy H
    • Amy, you're welcome. I'm glad you got it figured out.

      — commented July 27th 2012 by Shawn Lipscomb
  • Hi Libero, there appears to be an open bug ticket on changing the 'splash screen' for multiple resolutions at: http://jira.appcelerator.org/browse/TIMOB-3516

    The link provides information on how to modify the builder.py file to fix the issue.

    — answered July 5th 2011 by Kasthuri Jayarajah
    permalink
    0 Comments
  • I would like to add something to the fix, I am doing it here because I cannot comment on JIRA :
    They say to change "if re.search(pattern, path):" to "if re.search(pattern, path.replace("\", "/")):" \ is an escape character in python, so it should be "if re.search(pattern, path.replace("\", "/")):" 2\ in stead of 1.
    The fix worked for me just fine thank's for the usefull post :)

    — answered July 6th 2011 by Ahmed BOUSSADIA
    permalink
    0 Comments
  • Look up "9-patch images". In Titanium these will likely not work for stuff inside your app, but they will work in your splash screen.

    — answered March 6th 2013 by remko posthuma
    permalink
    1 Comment
    • The top part of this link (http://docs.appcelerator.com/titanium/latest/#!/guide/Icons_and_Splash_Screens-section-29004897_IconsandSplashScreens-Androidsplashscreenconsiderations)
      implies that 9-patch images are supported for splash screens, but scroll down and a note in yellow says they are not, and references this Jira item: (TIMOB-10801).

      — commented December 10th 2013 by Tom Gimpel
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.