开发者

How to move popup window while user scroll window using gesture detector

开发者 https://www.devze.com 2023-03-25 09:08 出处:网络
I am placing a popup window while the user scrolls the window using gesture detector, but it\'s not updating to the correct position.

I am placing a popup window while the user scrolls the window using gesture detector, but it's not updating to the correct position. Can anybody tell me how to do this? Can anybody tell me how to update the position?

public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX,
            float distanceY) {


        if(e1.getX() > e2.getX())
        {
                window.update((int)e1.getX(), (int)e1.getY(), -1, -1);

        }
        else
        {
            window.update((int)e2.getX(), (int)开发者_如何学Ce2.getY(), -1, -1);

        }


Simply you need the second MotionEvent Coordinates

public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
    window.update((int)e2.getX(), (int)e2.getY(), -1, -1);
}
0

精彩评论

暂无评论...
验证码 换一张
取 消