Skip to content

Imageview Problem in Android – Titanium

January 5, 2011

Yesterday  I was working to scaledown the dimension of an image for my Application in iPhone and  Android using Titanium. Without any effort I could achieve it in iPhone, but when I tried the same in Android I did not get the result I was expecting. The image was always taking up its original space without getting scaled down.

Finally  I got to the solution. In iPhone implementation of Titanium, by default the image is set to be scalable and for Android the it is not scalable.

Setting  canScale property to true and enableZoomControls to false did the trick for me.
By Default, enableZoomControls is true in Android. That is why we have set it to false.

Here is the code. Grab it.


var imageView = Ti.UI.createImageView({
 width: 40,
 height: 40,
 canScale:true,
 enableZoomControls:false,
 image: '/logo.png'
});

Advertisements

From → Android, iPhone, Titanium

One Comment
  1. I tried same but its not working. can you elaborate more.
    Thanks,
    Narendra

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: