2012-07-17 127 views
0

我想爲我的應用程序創建啓動畫面。問題是它首先渲染帶有默認標題欄的空佈局,然後淡入我的圖像中。禁用淡入淡出動畫

這是我的全部onCreate

super.onCreate(savedInstanceState); 
this.requestWindowFeature(Window.FEATURE_NO_TITLE); 
this.setContentView(R.layout.activity_splash); 

switching activities without animation

嘗試性解決方案也試過設置窗口屬性

WindowManager.LayoutParams lp = this.getWindow().getAttributes(); 
lp.windowAnimations = lp.windowAnimations | android.R.attr.windowDisablePreview; 
this.getWindow().setAttributes(lp); 

既不所做的任何明顯的差異。

回答

0

您可以通過爲您的飛濺活動設置主題來擺脫標題欄。將此添加到您的Manifest中的活動聲明中

android:theme="@android:style/Theme.NoTitleBar" 
+0

這使事情變得更好一些,但並未解決主要問題。我需要禁用默認動畫,以便它只顯示我的佈局,而不是將其淡入。 – 2012-07-17 18:12:38

+0

要擺脫活動性轉換,請使用'Activity.overridePendingTransition()'來覆蓋系統集合轉換。 – 2012-07-17 20:51:02

+0

調用'overridePendingTransition(0,0);'on'onCreate'似乎沒有效果。我認爲這意味着它不適用於任務中的第一個活動。 – 2012-07-17 21:03:44