Titanium SDK的webview组件不允许与它加载的网站进行交互



我正在尝试使用Titanium实现一个侧面板,其中在侧面板菜单下有几个选项,每个菜单选项都加载不同的视图。其中一个选项加载Web视图。网站或html在webview组件中完美加载,但我无法与之交互;从某种意义上说,我无法点击链接或做任何类似的事情。本地和远程html都会发生这种情况。

对于侧面板,我正在集成Ricardo Alcocer提供的抽屉小部件,他的github项目的链接是-https://github.com/ricardoalcocer/alloy-widget-drawermenu

下面是代码块。

index.xml

<Alloy>
    <Window class="container" id="win">
        <Require type="widget" src="com.alcoapps.drawermenu" id="drawermenu"/>
    </Window>
</Alloy>

mainview.xml(加载webview的侧菜单选项)

<Alloy>
    <View id="mainView">
        <View id="mainTopBar">
            <View id="menuButton"/>
        </View>
        <WebView id="chartView" url="http://www.google.co.in"/>
    </View>
</Alloy>

menuview.xml(侧板)

<Alloy>
    <View id="menuView">
        <View id="menuTopBar"/>
        <TableView class="menuTable" id="menuTable">
            <TableViewRow class="tableRow" id="row1">
                <View id="rowContainer">
                    <View id="rowSkull" class="rowIcon"/><Label id="rowLabel" class="rowLabel">MainView</Label>
                </View>
            </TableViewRow>
            <TableViewRow class="tableRow" id="row2">
                <View id="rowContainer">
                    <View id="rowGear" class="rowIcon"/><Label id="rowLabel" class="rowLabel">Settings</Label>
                </View>
            </TableViewRow>
        </TableView>
    </View>
</Alloy>

index.js

var controls=require('controls');
// get main and menu view as objects
var menuView=controls.getMenuView();
var mainView=controls.getMainView();
// attach event listener to menu button
mainView.menuButton.add(controls.getMenuButton({
    h: '60',
    w: '60'
}));
//Minor changes to click event. Update the menuOpen status;
mainView.menuButton.addEventListener('click',function(){
    $.drawermenu.showhidemenu();
    $.drawermenu.menuOpen=!$.drawermenu.menuOpen;
}); // method is exposed by widget

// get config view as objects
var configView=controls.getConfigView();
//add menu view to ConfigView exposed by widget
configView.menuButton.add(controls.getMenuButton({
                h: '60',
                w: '60'
            }));
//Minor changes to click event. Update the menuOpen status;
configView.menuButton.addEventListener('click',function(){
    $.drawermenu.showhidemenu();
    $.drawermenu.menuOpen=!$.drawermenu.menuOpen;
}); // method is exposed by widget
$.drawermenu.init({
    menuview:menuView.getView(),
    mainview:mainView.getView(),
    duration:200,
    parent: $.index
});
//variable to controler de open/close slide
var activeView = 1;
// add event listener in this context
menuView.menuTable.addEventListener('click',function(e){
    $.drawermenu.showhidemenu();
    $.drawermenu.menuOpen = false; //update menuOpen status to prevent inconsistency.
    if(e.rowData.id==="row1"){
        if(activeView!=1){
            $.drawermenu.drawermainview.remove(configView.getView());
            activeView = 1;
        } else {
            activeView = 1;
        }
    } 
    if(e.rowData.id==="row2"){
        if(activeView!=2){
            $.drawermenu.drawermainview.add(configView.getView());
            activeView = 2;
        } else{
            activeView = 2;
        }
    }
    // on Android the event is received by the label, so watch out!
    Ti.API.info(e.rowData.id); 
});
$.index.open();

controls.js

var Alloy=require('alloy');
exports.getMainView=function(){
    return Alloy.createController('mainview');;
};
exports.getMenuView=function(){
    return Alloy.createController('menuview');  
};
exports.getMenuButton=function(args){
    var v=Ti.UI.createView({
        height: args.h,
        width: args.w,
        backgroundColor: '#A1D0E0'
    });
    var b=Ti.UI.createView({
        height: "20dp",
        width: "20dp",
        backgroundImage: "/106-sliders.png"
    });
    v.add(b);
    return v;
};
//Get the Configuration Controller
exports.getConfigView=function(){
    return Alloy.createController('config');
};

我还没有提供设置页面的代码块(第二个侧面板菜单选项)以及样式表,我认为这不应该造成问题。

我看了一下Titanium Studio Webview,不允许我与网站互动但这对我没有帮助。我需要这种实现,我认为肯定应该有一些变通方法。

任何形式的帮助都会非常令人震惊。谢谢

好的,伙计们。我自己的问题有了答案。我只需要在tss文件中将webview的"willHandleTouches"属性设置为false。根本不知道这件事这么简单。:)