[英]How I do to put the default picture in android? (Splash-screen)
我正在開發一個android應用程序,我想放一張默認圖片。 這在iPhone應用程序中很常見; 當應用程序啟動時,它會顯示開發人員的姓名和帶有圖像的應用程序的名稱(例如)。
我認為這是可能的,因為像Facebook這樣的應用程序在應用程序啟動之前具有這些默認屏幕。 如何實施這些?
您想要的是啟動畫面:
在啟動活動的onCreate()
方法中,嘗試執行以下操作:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Thread proceed = new Thread(){
public void run()
{
try {
sleep(5000);
Intent next = new Intent("nextActivityIntentGoesHere");
startActivity(next);
} catch (InterruptedException e) {
e.printStackTrace();
}
finally{
finish();
}
}
};
proceed.start();
}
您的main.xml
可以如下所示:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@drawable/welcomescreenpicture" >
</LinearLayout>
啟動應用程序時,這將在5秒鍾內顯示welcomescreenpicture
屏幕圖片。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.