[英]Appcelerator show an image
Greetings, 问候,
I'm trying to simply display an image using Appcelerator on Android. 我正在尝试仅使用Android上的Appcelerator显示图像。
I don't understand why it won't work. 我不明白为什么它不起作用。
Here is my code: 这是我的代码:
var back=Titanium.UI.createImageView({
url:'images/back.png'
});
win.add(back);
I've also tried putting the image inside a view: 我还尝试将图像放入视图中:
var view = Titanium.UI.createView({
borderRadius:10,
backgroundColor:'red',
left:10,
right:10
});
var back=Titanium.UI.createImageView({
url:'images/back.png'
});
view.add(back);
win.add(view);
I'm totally stuck and am hoping someone can point me in the right direction here. 我完全被困住了,希望有人能在这里向我指出正确的方向。
Many thanks in advance, 提前谢谢了,
I got it working as follows: 我按如下方式工作:
var back_fn=Ti.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory,'images/back.png');
var back=Titanium.UI.createImageView({
image:back_fn,
top:10,
right:10
});
win.add(back);
Thanks for all the responses guys, 感谢大家的回复,
try this 尝试这个
var back=Titanium.UI.createImageView({
url:'images/back.png',
height : 130,
width : 130
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.