我有一个登录页面,如果用户点击登录页面,它将转到标签页。在标签页中,我调用了活动组页面。从活动组页面,它将调用主页活动页面。在家庭活动中,我将称之为webservices。当我点击登录时,它显示黑屏几分钟,需要时间。那时我必须为用户显示启动画面,直到加载标签栏。
我已实施,但以下代码无效。 style.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme" parent="@android:style/Theme">
<item name="android:windowBackground">@drawable/quest</item>
</style>
</resources>
的AndroidManifest.xml
<activity android:name=".HelloTabWidget"
android:theme="@style/Theme">
</activity>
有人可以提供示例代码吗?
由于
答案 0 :(得分:0)
public class Splash extends Activity {
// stopping splash screen starting home activity.
private static final int STOPSPLASH = 0;
// time duration in millisecond for which your splash screen should visible
// to
// user. here i have taken 5 second
private static final long SPLASHTIME = 5000;
// handler for splash screen
private Handler splashHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case STOPSPLASH:
// Generating and Starting new intent on splash time out
Intent intent = new Intent(getApplicationContext(),
ac.class);
startActivity(intent);
break;
}
super.handleMessage(msg);
}
};
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
// Generating message and sending it to splash handle
Message msg = new Message();
msg.what = STOPSPLASH;
splashHandler.sendMessageDelayed(msg, SPLASHTIME);
}
}
> try this code for splash screen.