在Titanium桌面应用程序中设置透明窗口背景

时间:2011-07-28 08:39:56

标签: transparency desktop titanium

一旦窗口已经创建,我需要以编程方式将窗口的背景设置为透明。

这会创建一个透明背景的新窗口。

Titanium.UI.createWindow({url:location.href,transparentBackground:true}).open()

后台透明度也可以在tiapp.xml中设置,但我需要在加载窗口后将其设置为

我也试过以下

var win = Titanium.UI.getCurrentWindow();
win.backgroundColor = 'transparent';

没有任何影响...

有没有办法实现这一目标?

3 个答案:

答案 0 :(得分:1)

也许您可以使用相同的组件创建2个窗口,一个透明,一个不透明。一旦你想透明背景显示关闭另一个窗口?

or win.setBackgroundColor('transparent');

答案 1 :(得分:0)

我将您的代码粘贴到点击事件中,它对我来说很好。我所做的就是将网址更改为“app://index.html”以进行测试。

$('.button').click(function(){      
  // test
  Titanium.UI.createWindow({url:'app://index.html',transparentBackground:true}).open();
});

您是否打开了网络检查器以检查js错误?

答案 2 :(得分:0)

如果您希望初始窗口透明,请添加此

<transparent-background>false</transparent-background>

<window />

在tiapp.xml文件上。