Android Home-Bildschirm wie Effekt flackert Problem, wenn child.setvisibility (View.Visible) eingestellt

Ich habe eine Beispielanwendung erstellt, um in einem Viewflipper durch verschiedene Layouts zu blättern.

XML ist im Grunde (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>

Und im 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
}

Über Pseudo-Code können Sie auch lineare Layouts im Viewflipper verschieben, wenn Sie sie auf dem Bildschirm ziehen (genau wie auf dem Startbildschirm).

Das Problem ist, wenn ich nextScreen.setVisibility (View.VISIBLE) mache. Wenn der nächste Bildschirm sichtbar ist, flackert er auf dem Bildschirm, bevor er an die entsprechende Position verschoben wird. (Ich schätze, es wird an Position 0 sichtbar gemacht.)

Gibt es eine Möglichkeit, den nächsten Bildschirm zu laden, ohne dass er auf dem Bildschirm flackert? Ich möchte, dass es außerhalb des Bildschirms geladen (sichtbar gemacht) wird, damit es nicht flackert.

Vielen Dank für Ihre Zeit und Ihre Hilfe!

Antworten auf die Frage(2)

Ihre Antwort auf die Frage