2010-11-30 71 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(); 
相关问题