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