开发者

how to show progress bar moving from one activity to another activity in android

开发者 https://www.devze.com 2023-01-27 08:18 出处:网络
I want to sh开发者_如何学Cow progress bar to going from one activity to another activity until another activity is loaded can anybody give example

I want to sh开发者_如何学Cow progress bar to going from one activity to another activity until another activity is loaded can anybody give example

Thanks


You can't have a progress to be displayed when switching to a new activity from current activity.


You can do this by declaring two progressbar inside a ViewFlipper in xml.

    <?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>

Then in your java program create a ViewFlipper object.

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

And call

    vf.showNext();

Thus you can show two ProgressBar. You can also apply animation that seems ProgressBars moves from one activity to next. Thanks...

    vf.setInAnimation(AnimationUtils.loadAnimation( getApplicationContext(), R.anim.right_in ));
    vf.setOutAnimation( AnimationUtils.loadAnimation( getApplicationContext(), R.anim.left_out ));
    vf.showNext();
0

精彩评论

暂无评论...
验证码 换一张
取 消