Does anyone know how to create a similar animation to the login animation used in the Google Plus Android app?
Is there something similar in the Android SDK that I can use? Or should I just build it from scratch? I'm interested especially in the fact that the UI behind the modal animation is dimmed and disabled.
<img alt="enter image description here" class="b-lazy" data-src="https://i.stack.imgur.com/O8QSl.png" data-original="https://i.stack.imgur.com/O8QSl.png" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" />Answer1:
Are you taking about that progress dialog spinning thingy that says "signing in"? That's not a custom animation at all, it's a common widget.
Here's the code:
ProgressDialog progressDialog = new ProgressDialog(this); progressDialog.setMessage("Signing in..."); progressDialog.show(); //... complete sign in...then progressDialog.dismiss();
A ProgressDialog done this way, automatically takes care of dimming/blurring the background. You should really read about dialogs: <a href="http://developer.android.com/guide/topics/ui/dialogs.html" rel="nofollow">http://developer.android.com/guide/topics/ui/dialogs.html</a>Answer2:
To show the progression with an animated progress bar:
1- Initialize the
ProgressDialog with the class constructor,
Set the progress style to
setProgressStyle(int) and set any other properties, such as the message.
2- When you're ready to show the dialog, call show() or return the
ProgressDialog from the onCreateDialog(int) callback.
3- You can increment the amount of progress displayed in the bar by calling either
setProgress(int) with a value for the total percentage completed so far or
incrementProgressBy(int) with an incremental value to add to the total percentage completed so far.
For example, your setup might look like this:
ProgressDialog progressDialog; progressDialog = new ProgressDialog(mContext); progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); progressDialog.setMessage("Loading..."); progressDialog.setCancelable(false);
The setup is simple. Most of the code needed to create a progress dialog is actually involved in the process that updates it. You might find that it's necessary to create a second thread in your application for this work and then report the progress back to the Activity's UI thread with a Handler object. If you're not familiar with using additional threads with a Handler, see the example Activity below that uses a second thread to increment a progress dialog managed by the Activity.