1
我知道如何從Android LiveWallpaper檢索標題欄的高度?動態壁紙標題欄的高度
我知道如何從活動中做到這一點:Height of statusbar?:
Rect rectgle= new Rect();
Window window= getWindow();
window.getDecorView().getWindowVisibleDisplayFrame(rectgle);
int StatusBarHeight= rectgle.top;
int contentViewTop=
window.findViewById(Window.ID_ANDROID_CONTENT).getTop();
int TitleBarHeight= contentViewTop - StatusBarHeight;
Log.i("*** Jorgesys :: ", "StatusBar Height= " + StatusBarHeight + " , TitleBar Height = " + TitleBarHeight);
但從WallpaperService.Engine,我不知道如何訪問getWindow()。
謝謝。
它不是很漂亮,但它的工作原理。只是一個remarque:代碼不應該直接在透明活動的onCreate方法,但在一個Runable調用有點延遲(我確定選擇一個seconde)。如果狀態和標題欄沒有返回0。 – PiR
嗯有趣..你嘗試調用onResume而不是使用Runnable嗎? –
在onResume沒有延遲我有同樣的問題比onCreate方法。我發現了延遲技巧[這裏](http://stackoverflow.com/questions/3407256/height-of-status-bar-in-android#comment11135530_4832438) – PiR