Android 钛2:获得图像大小?
我用钛。我用安卓NexusS进行测试 我有一个斑点,是画廊里的一张照片。我找不到一种方法来获得这张照片的宽度和高度 我已经看到了一些关于auto属性的提示,但是自从Tianium 2.0以来,这个提示似乎没有运行Android 钛2:获得图像大小?,android,iphone,titanium,Android,Iphone,Titanium,我用钛。我用安卓NexusS进行测试 我有一个斑点,是画廊里的一张照片。我找不到一种方法来获得这张照片的宽度和高度 我已经看到了一些关于auto属性的提示,但是自从Tianium 2.0以来,这个提示似乎没有运行 初试 结果“0 x 0” 第二次尝试 结果“自动x自动” 所以,我的简单问题是: 如何获取从图库中获取的照片的大小?经过几次尝试(在撰写此问题的过程中),我发现: Ti.Media.openPhotoGallery({ success : function(e) {
初试 结果“0 x 0”
第二次尝试 结果“自动x自动”
所以,我的简单问题是: 如何获取从图库中获取的照片的大小?经过几次尝试(在撰写此问题的过程中),我发现:
Ti.Media.openPhotoGallery({
success : function(e) {
var img = Ti.UI.createImageView({
image : e.media,
width: 'auto',
height: 'auto' });
alert(img.toImage().width + " x " + img.toImage().height);
}});
技巧是使用img.toImage().width
Ti.Media.openPhotoGallery({
success : function(e) {
var img = Ti.UI.createImageView({
image : e.media,
width: 'auto',
height: 'auto' });
alert(img.width + " x " + img.height);
}});
Ti.Media.openPhotoGallery({
success : function(e) {
var img = Ti.UI.createImageView({
image : e.media,
width: 'auto',
height: 'auto' });
alert(img.toImage().width + " x " + img.toImage().height);
}});