2016-07-17 131 views
0

All my code (links to imgur)ImageView未显示图像钛

为什么图像不显示在模拟器中?

的情况下,所有的代码,你不想点击上面的链接:

var win = Ti.UI.createWindow({ 
    backgroundColor: 'white' 
}); 

var image = Ti.UI.createImageView({ 
    image: '/images/name.png', 
    width:200 
}); 

win.add(image); 

win.open(); 

在上面的链接,你可以看到有没有拼写错误或任何

回答

1

没有指定的高度为ImageView

var image = Ti.UI.createImageView({ 
    image: '/images/name.png', 
    width:200, 
    height: Ti.UI.SIZE 
}); 

要么让Ti.UI.SIZE,如果你想让它动态的(如果你不知道的还高),或给它一个固定的高度吧。

+0

非常感谢,在所有的教程中,我看到人们说“你只需要指定高度或宽度,因为它会自动缩放”。我想,因为他们做了教程,有更新改变了那个或什么。 –