I am trying to use ViewFlipper and make it act like a home screen (the layout will be moved with my finger). Take a look at this for an example. I want to do this with a ViewFlipper that contains only two children, so I need to display the opposite view on both sides of the current view, depending on how the user moves his finger. This code works, but only for 1 direction at a time. This is onTouchEvent.
case MotionEvent.ACTION_MOVE: leftView.setVisibility(View.VISIBLE); rightView.setVisibility(View.VISIBLE);
Which of the two bottom lines that I put is the last one, that the direction will work correctly, and the other will not.
This is how I set leftView and rightView:
final View currentView = myFlipper.getCurrentView(); final View leftView, rightView; if (currentView == meView) { Log.d("current layout: ", "me"); leftView = youView; rightView = youView; } else if (currentView == youView) { Log.d("current layout: ", "you"); leftView = meView; rightView = meView; } else { leftView = null; rightView = null; }
Is it possible to configure it so that the same view is shown on both sides of the current view?
source share