2016-02-27 68 views
0

我正在尝试在我的应用(iOS,Android)中创建一条顶部消息。 当推送通知到达时,将显示此消息,但我无法做到。 这是我正在使用的代码。WhatsApp的消息顶部窗口

var MessageWindow = require('js/messageWindow'), 
    messageWin = new MessageWindow(); 
    messageWin.setLabel("Probando mensajes en la parte superior"); 
    messageWin.open(); 
    setTimeout(function(){ messageWin.close({opacity:0,duration:500}); },3000); 

并规定消息是:

function MessageWindow() { 
var win = Titanium.UI.createWindow({ 
top: 0, 
    height: '30%', 
    width: '98%', 
    borderRadius:10, 
    touchEnabled:false, 
}); 
var messageView = Titanium.UI.createView({ 
    id:'messageview', 
    height:'25%', 
    width: '95%', 
    borderRadius:10, 
    backgroundColor:'#000', 
    opacity:0.7, 
    touchEnabled:false 
}); 
var messageLabel = Titanium.UI.createLabel({ 
    id:'messagelabel', 
    text:'', 
    color:'#fff', 
    width: '85%', 
    height:'auto', 
    font:{ 
     fontFamily:'Helvetica Neue', 
     fontSize:13 
    }, 
    textAlign:'center' 
}); 
messageView.add(messageLabel); 
win.add(messageView); 
this.setLabel = function(_text) { 
    messageLabel.text = _text; 
}; 
this.open = function(_args) { 
    win.open(_args); 
}; 
this.close = function(_args) { 
    win.close(_args); 
}; }module.exports = MessageWindow; 

在这里,你有什么,我想

enter image description here

我试图在多种配置截图窗户没有成功.. 在此先感谢

回答

3

您可以使用this widgetTi.Notifications

enter image description here

+0

起坐!是为了允许.....可以这与经典的发展工作? –