android - How to trigger onClickListener for HorizontalScrollView? -


The question is that I want to tell everything.

Horizontal Scrollview is only a widget for which the setOnClickListener () triggers.

Note: I can not use touch events because it is the trigger 4-5 on every touch.

I too can not use my parents' view on touch because parents have many functions in the scene.


The following details are not important:

But still, these are the existing links I have searched for (no help): < / P>

>

I Many questions were asked, 1 of which was "OnClick Listener for Horizontal Scroll Weave"

< P> I have come in two ways to do this.

Simple (but less ideal):

  Horizontal scrollview scrollview = (horizontal scrollview) searchVBIID (RID scrollView)); ScrollView.setOnTouchListener (New On-TargetListener) {@ Override Public Boolean On Touch (see V, Motion Event Event) {if (event.getAction () == MotionEvent.ACTION_UP} {// do Stuff} false return;}} );   

When you click, drag or whatever you do with your finger, it will be asked only once, though it will respond to all types of gestures, so if you If you want to detect only tap / click events, then you need to check the "Event" object further and filter the events you do not need. This can be as much work as you want, so you should make better use of a gesturedate to do this.

This method leads to 2:

  Find horizontal scrollview scrollview = (horizontal scroll view) vbiid (rid scrollView); Final Gesture Detector Detector = New Gesture Detector (This, New OgsterListener) {@ Override Public Boolean on Ascultap (Motion Avenger E) {// Dot Stuff. Return Falls;} // Note that there are more ways here that will be displayed here // (which you probably do not need).}); ScrollView.setOnTouchListener (New On-TargetListener) {@ Override Public Boolean On Touch (see V, Motion Event Event) {detector.onTouchEvent (event); Return false;}});    

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -