如何获得触摸点(顶部和左)不论意见,钛窗如何获得、意见、钛窗

2023-09-08 00:21:22 作者:  x’佐珥 x’佑珥

我想,当我在我的MainView点击,我想的创建新窗口只是在那里我有感动

I want that when i click on my MainView, i want to create new window just where i have touched.

为说例如我已经点击了顶:50左:200 然后我的新窗口应从这一点开始仅

Say for e.g. i have clicked at top:50 left:200 then my new window should start from that point only.

我要创造这样的酥料饼在机器人。任何人都可以只是引导我?

I want to create something like Popover in Titanium for android. Can anyone just guide me?

先谢谢了。

推荐答案

考虑你有一个窗口的赢这就是要解雇这样的单击事件:

consider you have a window win thats going to fire the click event like that:

win.addEventListener('click',function(e){
        var myPopUp = createPopUp({
            left: e.x,
            top: e.y
        });
        myPopUp.open();
    });

您可以弹出类似的创建:

your popup could be created like that:

createPopUp = function(_args){
        var popup = Titanium.UI.createWindow({
                backgroundColor: 'red', /* a backgroundImage could be better */
                height: '250dp',
                width: '250dp',
                top: _args.top, /* manually adjusted */
                left: _args.left,
                opacity: 0.7 /* for a nice transparency*/
        });

        return popup;
    };

这工作在Android和iPhone。顶部的值似乎是一个小联合国precise但总的来说它的工作原理。

this works at android and iphone. the top values seems to be a little unprecise but in general it works.