Webview不会在图像点击上工作

时间:2014-03-04 08:43:46

标签: facebook webview titanium

因此,当我点击" facebook按钮"时,应打开webview。这是一个图像,但作为一个按钮。 有没有更好的方法来做到这一点,因为这是行不通的。 使用代码似乎很容易..

var fbbutton = Ti.UI.createImageView({
    image:"fb.png",
    top:"55%",
    zIndex:"1",
    height:"15%",
    width:"20%",
    left:"2%"   
});

fbbutton.addEventListener("click" , function(e){
         var webview = Titanium.UI.createWebView({url:'http://www.facebook.com'});
    var window = Titanium.UI.createWindow();
    window.add(webview);
    window.open();
});

1 个答案:

答案 0 :(得分:0)

尝试明确打开窗口:

fbbutton.addEventListener("click" , function(e){
    var webview = Titanium.UI.createWebView({url:'http://www.facebook.com'});
    var window = Titanium.UI.createWindow();
    window.add(webview);
    window.open({modal:true}); // Make modal
});
相关问题