Code example for ViewFlipper

Methods: setDisplayedChild

0
    TextView text2 = (TextView) helpContent.findViewById(android.R.id.text2);
    text2.setText(secondLine);
  } 
   
  public void setContentView(int which) {
    flipper.setDisplayedChild(which);
  } 
 
  public void animateContentView(final int child) {
    final View currentView = flipper.getCurrentView();
    final View nextView = flipper.getChildAt(child);
    TextView text1 = (TextView) currentView.findViewById(android.R.id.text1);
    TextView text2 = (TextView) currentView.findViewById(android.R.id.text2);
 
    AnimatorSet fadeAnim = new AnimatorSet();
    fadeAnim.playTogether(ObjectAnimator.ofFloat(text1, "alpha", 1, 0),
        ObjectAnimator.ofFloat(text2, "alpha", 1, 0));
 
    // AnimatorSet scaleAnim = new AnimatorSet(); 
    // scaleAnim.playTogether(ObjectAnimator.ofFloat(currentView, "scaleX", 1, 0.5f), 
    // ObjectAnimator.ofFloat(currentView, "scaleY", 1, 0.5f));