Note that there are some explanatory texts on larger screens.

plurals
  1. POScrollView within ViewFlipper does not work although using onTouchEvent
    primarykey
    data
    text
    <p>In this post: <a href="https://stackoverflow.com/questions/3032525/android-scrollview-in-flipper/6231082#6231082">Android: ScrollView in flipper</a></p> <p>It was suggested to set an onTouchnListener to the ScrollView which is part of a child of a ViewFlipper.</p> <p>I did that and also used the same logic:</p> <pre><code> public class MainActivity extends Activity implements OnGestureListener { // ... @Override protected void onCreate(Bundle savedInstanceState) { // ... this.gestureDetector = new GestureDetector(this); // .. createViews(); } private void createViews() { LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); displayView = inflater.inflate(R.layout.viewflippercontent, null); ScrollView scrollView = (ScrollView) displayView .findViewById(R.id.scrollview); scrollView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (gestureDetector.onTouchEvent(event)) { Log.d("ScrollViewOnTouchListener", "true"); return true; } else { Log.d("ScrollViewOnTouchListener", "false"); return false; } } }); // .. } @Override public boolean onTouchEvent(MotionEvent me) { Log.d("onTouchEvent", "onTouchEvent"); return gestureDetector.onTouchEvent(me); } public boolean onDown(MotionEvent e) { return true; } public void onLongPress(MotionEvent e) { } public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { Log.d("onScroll", "onScroll"); return false; } public void onShowPress(MotionEvent e) { } public boolean onSingleTapUp(MotionEvent e) { return true; } </code></pre> <p>}</p> <p>When I scroll in the child of the ViewFlipper I get the following in the LogCat:</p> <hr> <p>08-07 21:57:14.581: DEBUG/ScrollViewOnTouchListener(4586): true</p> <p>08-07 21:57:14.591: DEBUG/ScrollViewOnTouchListener(4586): false</p> <p>08-07 21:57:14.622: DEBUG/ScrollViewOnTouchListener(4586): false</p> <p>08-07 21:57:14.646: DEBUG/onScroll(4586): onScroll</p> <p>08-07 21:57:14.646: DEBUG/ScrollViewOnTouchListener(4586): false</p> <p>08-07 21:57:14.671: DEBUG/onScroll(4586): onScroll</p> <p>08-07 21:57:14.671: DEBUG/ScrollViewOnTouchListener(4586): false</p> <p>08-07 21:57:14.704: DEBUG/onScroll(4586): onScroll</p> <p>08-07 21:57:14.704: DEBUG/ScrollViewOnTouchListener(4586): false</p> <p>08-07 21:57:14.731: DEBUG/onScroll(4586): onScroll</p> <p>08-07 21:57:14.731: DEBUG/ScrollViewOnTouchListener(4586): false</p> <p>08-07 21:57:14.761: DEBUG/onScroll(4586): onScroll</p> <p>08-07 21:57:14.761: DEBUG/ScrollViewOnTouchListener(4586): false</p> <p>08-07 21:57:14.791: DEBUG/onScroll(4586): onScroll</p> <p>08-07 21:57:14.791: DEBUG/ScrollViewOnTouchListener(4586): false</p> <p>08-07 21:57:14.791: DEBUG/ScrollViewOnTouchListener(4586): true</p> <hr> <p>However no scrolling takes place although it should be possible since the content is bigger than the screen.</p> <p>What am I doing wrong? </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.
 

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