2017-05-30 46 views
2

幾秒鐘我想擺脫空白屏幕空白屏幕應用程序啓動後顯示幾秒鐘,但我只找到了「半透明主題解決方案」至今。但是我不能將這個解決方案應用到我的應用程序中,因爲啓動程序的活動是一個日誌記錄,並且使用「斷開連接」按鈕我希望能夠返回到它,而沒有半透明的主題。 有沒有辦法做到這一點? 非常感謝!爲Android上的應用程序啓動(無半透明主題avalaible)

+0

這就是所謂的閃屏或飛濺式活動。你可以創建自己的飛濺。在YouTube上有一些關於這個的教程 – PeMaCN

+0

我猜你忘了在你的Splash Screen的佈局文件中添加UI部分。 –

+0

您需要「加載」像_placeholder_圖片或從設備加載的簡單web視圖那樣快速的東西。然後,在後臺加載_slower加載_應用程序的東西。一旦加載,然後替換佔位符圖形/ web視圖。 – Tigger

回答

0

試試這個

public class SplashScreen extends Activity { 

// Splash screen timer 
private static int SPLASH_TIME_OUT = 3000; 

@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_splash); 

    getSupportActionBar().hide(); 

    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
      WindowManager.LayoutParams.FLAG_FULLSCREEN); 


    new Handler().postDelayed(new Runnable() { 

     /* 
     * Showing splash screen with a timer. This will be useful when you 
     * want to show case your app logo/company 
     */ 

     @Override 
     public void run() { 
      // This method will be executed once the timer is over 
      // Start your app main activity 
      Intent i = new Intent(SplashScreen.this, MainActivity.class); 
      startActivity(i); 

      // close this activity 
      finish(); 
     } 
    }, SPLASH_TIME_OUT); 
} 
} 

的更多信息,請follow this link

+0

正是我需要的!謝謝:3 – Dada

+0

非常歡迎,請率我的答案,如果它爲你工作@達達 –

+0

我會如果我有15分,對不起老兄 – Dada