动态壁纸标题栏的高度

时间:2012-09-17 15:16:25

标签: android height live-wallpaper titlebar

我知道如何从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()。

感谢。

1 个答案:

答案 0 :(得分:0)

我没有看到直接从服务中找到getWindow()的方法。作为一种解决方法,您可以创建透明活动,只需获得条形高度并自行完成。您可以在首次创建引擎服务时启动此活动。这不是理想的,但应该可以正常工作。

相关问题