androd主页面的动画效果。ViewFlipper实现起来很简单
1.定义一个xml文件

<Linearlayout android:layout_height="fill_parent" android:layout_width="fill_parent" android:orientation="vertical" xmlns:android=" 
 http:///apk/res/android"> 
 
   
   
  <Viewflipper android:id="@+id/flipper" 
 
   
   
   
   
   
   
   
  android:layout_height="fill_parent" 
 
   
   
   
   
   
   
   
  android:layout_width="fill_parent"> 
 

   
   
   
   
   
   
   
  <include android:id="@+id/firstlayout" layout="@layout/first"></include> 
 
   
   
   
   
   
   
   
  <include android:id="@+id/secondlayout" layout="@layout/second"></include> 
 
   
   
   
   
   
   
   
  <include android:id="@+id/thirdlayout" layout="@layout/third"></include> 
 
   
   
   
   
   
   
   
  <include android:id="@+id/fourthlayout" layout="@layout/fourth"></include> 
 
   
   
   
 
   
   
   
  </Viewflipper> 
 
 </Linearlayout> 
 
 2.ViewFlipper在同一个页面就显示其中一个layout。ViewFlipper中的四个layout很简单,我们就放置一张图片,如下所示: 
 <Linearlayout android:gravity="center_vertical"
   android:layout_height="fill_parent"   
   android:layout_width="fill_parent" xmlns:android="http:///apk/res/android">
     <imageview android:layout_height="wrap_content"          android:layout_width="wrap_content"  
          android:src="@drawable/v1">
 </imageview></Linearlayout>
     
   
   
   
   
   
   
   
   
  1>显示前一个后一个动画并设置进出动画方式 
 
   
   
   
   
   
   
   
   
  mFlipper.setInAnimation(inFromLeftAnimation()); 
 
   
   
   
   
   
   
   
   
  mFlipper.setOutAnimation(outToRightAnimation()); 
 
   
   
   
   
   
   
   
   
  mFlipper.showPrevious(); 
 
   
   
   
   
   
   
   
   
 
   
   
   
   
   
   
   
   
  mFlipper.setInAnimation(inFromRightAnimation()); 
 
   
   
   
   
   
   
   
   
  mFlipper.setOutAnimation(outToLeftAnimation()); 
 
   
   
   
   
   
   
   
   
  mFlipper.showNext(); 
 
       2>开始停止动画
        mViewFlipper.stopFlipping();
        mViewFlipper.startFlipping();