简体   繁体   中英

Android - Scrollable TextView with OnClickListener

I have a scrollable textview with an onClickListener attached to it.

textView.setOnClickListener( new OnClickListener() {
                @Override
                public void onClick(View v) {
                    //DoStuff();
                }
            });

The problem is if I scroll the text, as soon as I lift my finger off the view it triggers the onClickListener. The only way this doesn't happen is if I scroll and then move off the view before I lift my finger, and I can't exactly tell my users to do that :P

So my question is, is there a way to determine between a click and a scroll or is the only way to do this to use an onTouchListener and decide for myself if it was a scroll or a click?

使用onTouchListener并处理ON_DOWN和ON_MOVE而不是使用onClick。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM