OnTouchEvent更新值问题Android

OnTouchEvent update value Issue Android

朋友们大家好,
我做了一个游戏,你需要按下一个球,球会增加他的大小。 现在我的问题是,当我调用 onTouchEvent 并调用函数 increaseRadius() 时,它会在手指在屏幕上移动时更新我的​​值,但是如果我不移动手指,它会更新一次值。 我希望即使玩家将手指放在同一坐标中也能更新该值(就像更新循环一样)。 onTouchListener 只有在手指移动时才能正常工作,否则它只能工作一次。

这里是'short'代码:

public boolean onTouchEvent(MotionEvent event)
{
    if(userball.getRadius()<screenWidth/4)
    {
       userball.increaseRadius();
    }
}
public void increaseRadius()
{
    this.radius+=screenWidth*0.002;
}

这些是没有与问题无关的内容的功能。 我将如何更改它,即使玩家不移动他的手指,球也会更新并增加他的大小?

我希望玩家的手指在屏幕上的同一坐标上(如 while 循环)的整个时间内更新该值。

使用if语句判断玩家是否只放了his/her个手指:

if (event.getAction() == MotionEvent.ACTION_DOWN) {

}

类似地,如果你想监听拖拽事件,你可以这样写你的 if 语句:

if (event.getAction() == MotionEvent.ACTION_MOVE) {

}

为了让进程在用户手指触摸时继续进行,您可以启动一个线程,如下例所示:

if (event.getAction() == MotionEvent.ACTION_DOWN) {
    IncreaseSizeThread increaseSizeThread = new IncreaseSizeThread();
}

if (event.getAction() == MotionEvent.ACTION_UP) {
    increaseSizeThread.stop(); 
    //A better way would be to change a variable that gets the while loop in     
    //the thread going to false e.g. keepGoing = false;

}

线程的内容可以是:

class IncreaseSizeThread extends Thread {

    public IncreaseSizeThread() {
    }

    void run(){
        while(keepGoing){
            //Size++;
        }

    }
}