Set the original background color before upload
I think this is exactly what you need.
First define the color in /colors.xml values
<resources>
<color name="background">#FFFFFF </color>
</resources>
Create a themes.xml file in res / values that references this color:
<resources>
<style name="MyTheme" parent="@android:style/Theme.Light">
<item name="android:windowBackground">@color/background</item>
</style>
</resources>
... and then in your AndroidManifest.xml, specify this as the theme for your activity.
<activity
android:name=".MyActivity"
android:theme="@style/MyTheme" />
source to share
You can do one of the following:
setContentView
can be called multiple times in the activity lifecycle. This way, you can simply set another layout file that only shows the background as you wish, and once you're done loading, call again setContentView
to load the actual layout!
OR
You can just manage all of this in one layout file by giving your root view a white background color than needed to show / hide the required section!
source to share
From the documentation
setContentView (int layoutResID)
Set the content of the activity from the layout resource. The resource will be overestimated, adding all kinds of top level to the activity.
So the background color before setContentView()
But try
-
Avoid too much code in
onCreate()
Activity
. -
Use
AsyncTask
to load data and display toprogressbar
user -
Or you can implement some
splash screen
before loading the main oneActivity
.
source to share