简体   繁体   English

我如何在钛项目中使用局部图像

[英]how can i use use local images in my titanium project

i'm trying to change my background of a window in titanium , unfortuantly its not working. 我正在尝试更改钛合金窗户的背景,不幸的是它无法正常工作。 i also tried to use many local images and they did't load. 我也尝试使用许多本地图像,但它们没有加载。 any help is highly appreciated ,How can use my resources ? 非常感谢您的帮助,如何使用我的资源?

var win1 = Titanium.UI.createWindow({  
title:'Hello',
backgroundImage:'back.png',
});

You can do that, just like that. 您可以那样做。 backgroundImage is supported on window. 窗口支持backgroundImage

Just make sure you use the right path: 只要确保您使用正确的路径即可:

backgroundImage: Ti.FileSystem.resourcesDirectory + 'back.png'

Here I am assuming back.png (case sensitive) is actually in the resources directory root. 在这里,我假设back.png(区分大小写)实际上位于资源目​​录的根目录中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM