Titanium Community Questions & Answer Archive

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

imageView scaling in Android

I'm adding an image my window using this code:

var thisImage = Ti.UI.createImageView({
    width: 110,
    height: 75,
    url: '1_over.png',
    size: { height: 75, width: 110 }

The image is scaled up around 120%. I read that this is a common problem, but everyone says that the canScale property fixes this, but it doesn't. Anyone ?

I am using Titanium SDK 1.4.0. and testing it on Android 2.1. The resolution of my emulator is 800x480, maybe that is a problem?

Thanks in advance,
Rik de Vos

— asked November 6th 2010 by Rik de Vos
  • android
  • canscale
  • imageview
  • scale

2 Answers

  • Accepted Answer

    Hi Rik

    First of all, the imageView url property has been deprecated - don't use it! Take a look at the ImageView-object documentation.

    There is a known bug with image scaling. Look at ticket #1434 for further info.



    — answered November 6th 2010 by Paul Dowsett
  • Thanks Hal, but it didn't really help me :(

    Yes, the url property has been deprecated, but even if I use 'image' instead of 'url' it still doesn't work.

    So I looked at ticket #1434, but with the canScale property on, and then the enableZoomControls property off it still doesn't work.

    The image is 110 x 75, but when I set the height and with to around 73 x 50 , which is 0.67 times the original size, the image does show as 110 x 75. This doesn't make any sense ?!?

    — answered November 6th 2010 by Rik de Vos
    1 Comment
    • You need to read the ticket again more carefully.

      — commented November 6th 2010 by Paul Dowsett
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.