Note that there are some explanatory texts on larger screens.

plurals
  1. POGestureDetector onFling
    primarykey
    data
    text
    <p>I am using <code>onFling</code> function to swipe with the <code>ScrollView</code>. The problem I am facing is that when I swipe/scroll from top to bottom it swipes my tab from one to another right/left. So I need that my swipe left/right function doesn't work when I scroll.</p> <pre><code>public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { final RelativeLayout detail = (RelativeLayout) findViewById(R.id.layout_detail); final RelativeLayout photo = (RelativeLayout) findViewById(R.id.layout_detail_photo); final RelativeLayout pod = (RelativeLayout) findViewById(R.id.layout_detail_pod); final ToggleButton btn_detail = (ToggleButton) findViewById(R.id.btn_detail); final ToggleButton btn_pod = (ToggleButton) findViewById(R.id.btn_pod); final ToggleButton btn_photo = (ToggleButton) findViewById(R.id.btn_photo); // right to left swipe if (e1.getX() - e2.getX() &gt; SWIPE_MIN_DISTANCE &amp;&amp; Math.abs(velocityX) &gt; SWIPE_THRESHOLD_VELOCITY) { if ((detail.getVisibility() == View.VISIBLE) &amp;&amp; (pod.getVisibility() == View.GONE) &amp;&amp; (photo.getVisibility() == View.GONE)) { detail.setVisibility(View.GONE); photo.setVisibility(View.GONE); pod.setVisibility(View.VISIBLE); btn_photo.setSelected(false); btn_pod.setSelected(true); btn_detail.setSelected(false); } else if ((detail.getVisibility() == View.GONE) &amp;&amp; (pod.getVisibility() == View.VISIBLE) &amp;&amp; (photo.getVisibility() == View.GONE)) { detail.setVisibility(View.GONE); photo.setVisibility(View.VISIBLE); pod.setVisibility(View.GONE); btn_photo.setSelected(true); btn_pod.setSelected(false); btn_detail.setSelected(false); } else if ((detail.getVisibility() == View.GONE) &amp;&amp; (pod.getVisibility() == View.GONE) &amp;&amp; (photo.getVisibility() == View.VISIBLE)) { detail.setVisibility(View.VISIBLE); photo.setVisibility(View.GONE); pod.setVisibility(View.GONE); btn_photo.setSelected(false); btn_pod.setSelected(false); btn_detail.setSelected(true); } } // left to right swipe else if (e2.getX() - e1.getX() &gt; SWIPE_MIN_DISTANCE &amp;&amp; Math.abs(velocityX) &gt; SWIPE_THRESHOLD_VELOCITY) { if ((detail.getVisibility() == View.VISIBLE) &amp;&amp; (pod.getVisibility() == View.GONE) &amp;&amp; (photo.getVisibility() == View.GONE)) { detail.setVisibility(View.GONE); photo.setVisibility(View.VISIBLE); pod.setVisibility(View.GONE); btn_photo.setSelected(true); btn_pod.setSelected(false); btn_detail.setSelected(false); } else if ((detail.getVisibility() == View.GONE) &amp;&amp; (pod.getVisibility() == View.GONE) &amp;&amp; (photo.getVisibility() == View.VISIBLE)) { detail.setVisibility(View.GONE); photo.setVisibility(View.GONE); pod.setVisibility(View.VISIBLE); btn_photo.setSelected(false); btn_pod.setSelected(true); btn_detail.setSelected(false); } else if ((detail.getVisibility() == View.GONE) &amp;&amp; (pod.getVisibility() == View.VISIBLE) &amp;&amp; (photo.getVisibility() == View.GONE)) { detail.setVisibility(View.VISIBLE); photo.setVisibility(View.GONE); pod.setVisibility(View.GONE); btn_photo.setSelected(false); btn_pod.setSelected(false); btn_detail.setSelected(true); } } return true; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload