如何获得触摸点(顶部和左)不论意见,钛窗 [英] How to get the Touch point (top and left) irrespective of the views, windows in Titanium

查看:128
本文介绍了如何获得触摸点(顶部和左)不论意见,钛窗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想,当我在我的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.

这篇关于如何获得触摸点(顶部和左)不论意见,钛窗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆