Titanium Community Questions & Answer Archive

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

Device differences

I understand that each device has their own set of UI components.

Setting something like the background image on a window should be universal though, right? And what is up with the button on the droid?

alt text
alt text

— asked November 29th 2010 by Ronnie Swietek
  • device
  • ui
0 Comments

4 Answers

  • Without seeing your code, I'm not sure why you're not getting the background image on Android. It's certainly supported. I've set background images on a couple of my apps. The platforms stretch button images differently, which is what you're seeing with the button. iOS seems to cut out and expand the middle portion, leaving the edges with the same shape as the original. Pretty cool. Android just stretches the whole thing, creating the ugly weirdness you're seeing.

    iOS doesn't support button background colors, though Android does. You could use the stock buttons, create full-size (non-stretched) button background graphics, or code platform-specific solutions.

    — answered November 29th 2010 by Tim Poulsen
    permalink
    0 Comments
  • Tim / Ronnie,

    Actually, Android does support intelligent stretching of images. It just does it in a different manner than iOS. And at least in 1.4.x, support for it is limited to buttons and labels.

    However, you can get button images to stretch nicely in Android provided you create a "9 patch" image which conveys to Android how it should stretch the image.

    As it so happens, I was just trying to fix this problem myself today and Hal kindly pointed me in the right direction. See his response in this thread:

    http://developer.appcelerator.com/question/83791/do-backgroundleftcap-and-backgroundtopcap-work-on-android-buttons

    — answered November 30th 2010 by Doug Handy
    permalink
    0 Comments
  • thanks for the info on the buttons. Does that means I hae use different images for the iphone and android?

    Regarding the background image, I just realized I am using tabGroup.backgroundImage rather than window.backgroundImage

    Is that only supported by iphone?

    — answered December 2nd 2010 by Ronnie Swietek
    permalink
    0 Comments
  • Yes, I now use different images for android vs iphone so the 1-pixel border on the android 9 patch images does not show up as partial black lines under iOS. But the good news is Titanium will bundle in the correct image at build time if you put them in the iphone and android subfolders of Resources.

    I don't know about your background image question.

    — answered December 2nd 2010 by Doug Handy
    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.