如何创建一个弹窗Window但不丢失之前的Window
How to create a pop up Window but not lose the previous Window
我创建了一个新的小 window 以使用 Onlick 功能打开。当新的弹出窗口打开时,如何保留之前的 window?现在我的弹出窗口外面有一个黑色背景。
XML
<Alloy>
<Window id="container" backgroundImage="/images/art.jpg">
<View id="weSocial" width="95%" top="8" backgroundColor="#393939" height="50" visible="true" onClick="showSocial">
<Label id="socialLabel"></Label>
</View>
</Window>
</Alloy>
JS:
var ModalWindow = Ti.UI.createWindow({
title: L('findSocial'),
backgroundColor: "red",
width: "300",
height: "300",
modal: true,
top: "10%"
});
$.win.add.ModalWindow;
function showSocial () {
ModalWindow.open({modal:true});
}
您正在考虑一个视图。 iOS 内的 window(如果我没记错的话,还有 Android)总是 100% 宽和高。
即使您的观看率为 95%,window 也不是。它是黑色的原因是因为您的 window 有黑色背景。
要更改此设置,无需打开新的 window,只需将视图添加(并覆盖)到您当前的 window。
你的新 XML:
<Alloy>
<View id="weSocial" width="95%" top="8" backgroundColor="#393939" height="50" visible="true" onClick="showSocial">
<Label id="socialLabel"></Label>
</View>
</Alloy>
通过控制器将其包含在您之前的 window 中:
var controller = Alloy.createController('modalWindow');
添加并显示:
$.getView().add(controller.getView());
你的 modalWindow
的 tss 应该仍然是 95% 宽,不要使用左右定位,它会自动居中。
我创建了一个新的小 window 以使用 Onlick 功能打开。当新的弹出窗口打开时,如何保留之前的 window?现在我的弹出窗口外面有一个黑色背景。
XML
<Alloy>
<Window id="container" backgroundImage="/images/art.jpg">
<View id="weSocial" width="95%" top="8" backgroundColor="#393939" height="50" visible="true" onClick="showSocial">
<Label id="socialLabel"></Label>
</View>
</Window>
</Alloy>
JS:
var ModalWindow = Ti.UI.createWindow({
title: L('findSocial'),
backgroundColor: "red",
width: "300",
height: "300",
modal: true,
top: "10%"
});
$.win.add.ModalWindow;
function showSocial () {
ModalWindow.open({modal:true});
}
您正在考虑一个视图。 iOS 内的 window(如果我没记错的话,还有 Android)总是 100% 宽和高。
即使您的观看率为 95%,window 也不是。它是黑色的原因是因为您的 window 有黑色背景。
要更改此设置,无需打开新的 window,只需将视图添加(并覆盖)到您当前的 window。
你的新 XML:
<Alloy>
<View id="weSocial" width="95%" top="8" backgroundColor="#393939" height="50" visible="true" onClick="showSocial">
<Label id="socialLabel"></Label>
</View>
</Alloy>
通过控制器将其包含在您之前的 window 中:
var controller = Alloy.createController('modalWindow');
添加并显示:
$.getView().add(controller.getView());
你的 modalWindow
的 tss 应该仍然是 95% 宽,不要使用左右定位,它会自动居中。