Hello,
I have made a sample application to flip through different layouts in a viewflipper.
XML is basically (pseudo-code)
<ViewFlipper>
<LinearLayout><TextView text:"this is the first page" /></LinearLayout>
<LinearLayout><TextView text:"this is the second page" /></LinearLayout>
<LinearLayout><TextView text:"this is the third page" /></LinearLayout>
</ViewFlipper>
And in Java code,
public boolean onTouchEvent(MotionEvent event)
case MotionEvent.ACTION_DOWN {
oldTouchValue = event.getX()
} case MotionEvent.ACTION_UP {
//depending on Direction, do viewFlipper.showPrevious or viewFlipper.showNext
//after setting appropriate animations with appropriate start/end locations
} case MotionEvent.ACTION_MOVE {
//Depending on the direction
nextScreen.setVisibility(View.Visible)
nextScreen.layout(l, t, r, b) // l computed appropriately
CurrentScreen.layout(l2, t2, r2, b2) // l2 computed appropriately
}
Above pseudo code works well moving linearlayouts inside viewflipper when dragging on the screen (just like the home screen).
The problem is when I do nextScreen.setVisibility(View.VISIBLE). When the next screen is set visible, it flickers on the screen before moving to its appropriate position. (I guess it is made visible at 0 location.)
Is there a way to load the next screen without making it flicker on the screen? I want it to be loaded (made visible) out of screen so it doesn't flicker.
Thank you very much for your time and help!