开发者

Android - How to detect a single tap on a LinearLayout?

I have a View and I need to detect a single tap on a LinearLayout. I don't care about movements, All I want to dete开发者_JAVA百科ct is a single tap. Basically a touch detection just like the touch detection on buttons. How can I achieve this?

myView.setOnTouchListener(new OnTouchListener(){
    @Override
    public boolean onTouch(View v, MotionEvent event) {
        // This gets called so many times on every movement
        return true;
    }
});


I'm pretty sure, this would work aryaxt:

myView.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
       // myView tapped //
    }
});
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜