2010-12-09 26 views
0

我有一个登录页面,如果用户点击登录页面,它会转到标签页。在标签页我称为活动组页面。从活动组页面,它会打电话给家庭活动页面。在家庭活动中,我会打电话给web服务。当我点击登录时,它显示黑屏几分钟,这需要时间。那时我必须为用户显示启动画面,直到标签栏被加载。启动画面不能用于具有标签栏的活动组android

我实现了,但下面的代码不起作用。 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

什么,我觉得你必须实现一种多线程来实现这一目标。 – 2010-12-09 14:11:39

回答

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.