Reputation: 434
Currently, I am trying to create splash screen with this animation: Progress Bar Effect
From the start, I thought of creating the progress bar, however, I can't make it and unable to find exact design. Thus, I was planning using animation method but most of the tutorial are fade in/our or move the item from left to right. Any idea how to create this kind of animation in splash screen (3 second)?
Upvotes: 0
Views: 665
Reputation: 164
You can make this manually using handler to make the images appear after period of time.
At first you will create a layout containing these images and make them invisible, then in the handler show them one by one.
here's how to do it.
this is in layout:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:id="@+id/img1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:src="@android:drawable/presence_online"
android:visibility="invisible" />
<ImageView
android:id="@+id/img2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:src="@android:drawable/presence_online"
android:visibility="invisible" />
<ImageView
android:id="@+id/img3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:src="@android:drawable/presence_online"
android:visibility="invisible" />
<ImageView
android:id="@+id/img4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:src="@android:drawable/presence_online"
android:visibility="invisible" />
</LinearLayout>
and this in java class:
final int TIME_OUT = 1000;
final ImageView imageView1 = (ImageView) findViewById(R.id.img1);
final ImageView imageView2 = (ImageView) findViewById(R.id.img2);
final ImageView imageView3 = (ImageView) findViewById(R.id.img3);
final ImageView imageView4 = (ImageView) findViewById(R.id.img4);
new Handler().postDelayed(new Runnable() {
// This method will be executed once the timer is over
@Override
public void run() {
imageView1.setVisibility(View.VISIBLE);
}
}, TIME_OUT);
new Handler().postDelayed(new Runnable() {
// This method will be executed once the timer is over
@Override
public void run() {
imageView2.setVisibility(View.VISIBLE);
}
}, TIME_OUT * 2);
new Handler().postDelayed(new Runnable() {
// This method will be executed once the timer is over
@Override
public void run() {
imageView3.setVisibility(View.VISIBLE);
}
}, TIME_OUT * 3);
new Handler().postDelayed(new Runnable() {
// This method will be executed once the timer is over
@Override
public void run() {
imageView4.setVisibility(View.VISIBLE);
}
}, TIME_OUT * 4);
you can change the TIME_OUT as it suits you and so the android:src.
i tried this and works well.
if there's anything not clear let me know.
Upvotes: 1
Reputation: 3812
For the ProgressBar effect as indicator of progress, please look at the reference here. Also take a look at thread of suggestions as well as the selected answer here - they show how to do a progress bar animation. You can also look at the selected answer here about making the progress bar to update smoothly. I hope this points you in the right direction.
Upvotes: 0