2010-11-30 74 views

回答

1

你切換到新活動時無法顯示進度。

0

您可以通過在xml中的ViewFlipper中聲明兩個progressbar來完成此操作。

<?xml version="1.0" encoding="utf-8"?> 
     <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:orientation="vertical" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:id="@+id/lah" 
     > 
     <ViewFlipper 
     android:id="@+id/myFlipper" 
     android:layout_height="fill_parent" 
     android:layout_width="fill_parent" 
     > 
      <LinearLayout 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" > 

      <ProgressBar 
         android:id="@+id/first_progressbar" /> 
      </LinearLayout> 



      <LinearLayout 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" > 

      <ProgressBar 
         android:id="@+id/second_progressbar" /> 

      </LinearLayout> 


     </ViewFlipper> 

    </LinearLayout> 

然後在你的java程序中創建一個ViewFlipper對象。

ViewFlipper vf = (ViewFlipper) findViewById(R.id.myFlipper); 

並調用

vf.showNext(); 

因此,你可以顯示兩個進度。您還可以應用ProgressBars從一個活動移動到下一個的動畫。謝謝...

vf.setInAnimation(AnimationUtils.loadAnimation(getApplicationContext(), R.anim.right_in)); 
    vf.setOutAnimation(AnimationUtils.loadAnimation(getApplicationContext(), R.anim.left_out)); 
    vf.showNext(); 
相關問題