Loading screen in Android
What's the best way to create a reusable loading screen in Android? The loading screen should have a background image and a loading indicator.
Should I use a separate act开发者_如何学Civity?
The best way is using a separate activity with a SurfaceView
that shows the image. Then, you can create an overlay that contains the ProgressBar
.
You just could define your own dialog with custom layout. You would handle what happens if your progress screen gets cancelled (pressing back button). You could also prevent it from happening too.
By using an standard dialog you take adavantage of nice efects (background activity darkening with upgrades) and prevents user from interacting with background activity while it is on.
精彩评论