How do I show the splash screen until the tab bar is loaded in and开发者_运维百科roid? Can anybody give an example?
I have a login screen. From the login screen, if the user clicks the login button, I am getting data from the webservice and loading tab bar in an android activity at that time the screen will be black it takes time for the tabbar to load. I want to display the splash screen.
Thanks
You can do this by applying a theme to the activity that you want to display the loading screen.
<style name="Theme" parent="@android:style/Theme">
<item name="android:windowBackground">@drawable/loadscreen</item>
</style>
and in the manifest
<activity android:name=".MyTabActivity" android:theme="@style/Theme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
your activity will now display the loadscreen drawable instead of a black screen while its loading.
精彩评论