2016-02-27 67 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

起坐!是爲了允許.....可以這與經典的發展工作? –