Android 获得图像高度和钛合金材质

Android 获得图像高度和钛合金材质,android,iphone,titanium,titanium-mobile,Android,Iphone,Titanium,Titanium Mobile,我需要从服务器获取图像的高度和宽度,以便直接向用户显示 因此,我尝试创建一个imageView并将图像放入其中,这样我就可以读取imageView的高度和宽度 var image = Ti.UI.createImageView({ image : //host Site, width : "auto", height : "auto" }); var hight = imag

我需要从服务器获取图像的高度和宽度,以便直接向用户显示

因此,我尝试创建一个imageView并将图像放入其中,这样我就可以读取imageView的高度和宽度

var image = Ti.UI.createImageView({
                image : //host Site,
                width : "auto",
                height : "auto"
            });

var hight = image.height;
var width = image.width;
但它总是返回hight=auto和width=auto


如何获得高度和宽度,如示例hight=630和WITH=320?

首先,收听
load
postlayout
事件: 取而代之的是,您可以获取
图像视图的
维度
:如下所示:

var rect = image.getRect();

我想出了如何获得图像的高度和宽度

 var image = Ti.UI.createImageView({
                image : //host Site,
                width : "auto",
                height : "auto"
            });

var hight = image.toBlob().height;
var width = image.toBlob().width;
我只想在尝试获取高度和宽度的地方添加toBolob()