ビューフリッパーでさまざまなレイアウトをめくるためのサンプル アプリケーションを作成しました。
XMLは基本的に(疑似コード)
<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>
そして Java コードでは、
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
}
上記の疑似コードは、画面上でドラッグするときに (ホーム画面のように) viewflipper 内で線形レイアウトをうまく移動します。
問題は、nextScreen.setVisibility(View.VISIBLE) を実行するときです。次の画面が表示されるように設定されると、適切な位置に移動する前に画面上でちらつきます。(0の位置で見えるようになっていると思います。)
画面がちらつくことなく次の画面を読み込む方法はありますか? ちらつきがないように、画面の外にロード(表示)したい。
お時間をいただき、ありがとうございました。