Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid How to call OnFling when Swiping anywhere in the Activity not only in the ViewFlipper
    primarykey
    data
    text
    <p>In my viewFlipper some TextViews are loaded dynamically. The size may differ which means that under the viewFlipper there could be some space left (see the green part in the screenshot)</p> <p><a href="http://img690.imageshack.us/img690/6695/viewflipperandbackgourn.png" rel="nofollow">screenshot</a></p> <p>I want the onFling method to be called not only when swiping on the grey part (which is the viewflipper) but also when swiping on the green part</p> <p>my layout looks like this:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:id="@+id/root"&gt; &lt;ViewFlipper android:id="@+id/viewFlipper" android:layout_width="fill_parent" android:layout_height="wrap_content"&gt; &lt;/ViewFlipper&gt; &lt;/RelativeLayout&gt; </code></pre> <p>In my onCreate i do this:</p> <pre><code>this.viewFlipper = (ViewFlipper) this.findViewById(R.id.viewFlipper); this.gestureDetector = new GestureDetector(new MyGestureDetector()); RelativeLayout root = (RelativeLayout) this.findViewById(R.id.root); root.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (gestureDetector.onTouchEvent(event)) { Log.d("root", "true"); return false; } else { Log.d("root", "false"); return false; } } }); </code></pre> <p>So far I tried to return false even if I get true, so that the event does not get consumed and gets passed down to the viewFlipper even if the swipe has been made outside the viewflipper. </p> <p>Note that the viewFlipper does not need any explicit onTouchListener. It works with or without one ( I dont really understand why..)</p> <p>Does anyone know what to do?</p>
    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