2012-10-03 49 views
2

我需要根視圖傳遞給一個函數,以顯示一個彈出窗口什麼是根視圖?

instructions_popup_window.showAtLocation("parent view", Gravity.CENTER, 0, 0); 

問題是用什麼作爲"parent view"

onCreate

setContentView(R.layout.splash); 

所以是我的根視圖:"R.layout.splash""findViewById(R.layout.splash)"或別的東西完全?

回答

2

根視圖是您的飛濺佈局中最頂層的視圖。

你可以給它一個ID,然後,或者你可以得到這個功能活動的根視圖:

getWindow().getDecorView()