什么是Android DecorView? [英] What is an Android DecorView?

查看:120
本文介绍了什么是Android DecorView?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

http://developer.android.com/reference/android/view/Window .html#getDecorView():

检索顶级窗口装饰视图(包含标准窗口) 框架/装饰以及其中的客户内容),可以将其添加为 窗口到窗口管理器.

Retrieve the top-level window decor view (containing the standard window frame/decorations and the client's content inside of that), which can be added as a window to the window manager.

这令人困惑.目前尚不清楚标准的窗框/装饰"是什么.确切地说,我对此一无所知,而且文档也很糟糕.它是否存在于应用程序的窗口中?它是否围绕应用程序的窗口?

This is baffling. It is not clear what the standard "window frame/decorations" are. I'm at a loss as to what this is, exactly, and the documentation is terrible. Does it exist inside the application's window? Does it surround the application's window?

我从未见过带有明显窗户装饰的Android窗户. 可以作为窗口添加的"意味着装饰视图是一个窗口,但是与类层次结构相矛盾(View不是Window的子类).

I have never seen an Android window with noticeable window decorations. And "which can be added as a window" implies that a decor view is a window, but that contradicts the class hierarchy (View is not a subclass of Window).

那是怎么回事?装饰视图到底是什么?

So what's the deal? What exactly is the decor view?

推荐答案

似乎定义最好的地方之一是在

Seems that one of the places where it's best defined is in Romain Guy's Blog:

DecorView是实际上包含窗口背景可绘制的视图.从您的Activity中调用getWindow().setBackgroundDrawable()可以通过更改DecorView的背景可绘制对象来更改窗口的背景.如前所述,此设置非常特定于当前的Android实现,并且可以在将来的版本中甚至在其他设备上进行更改.

The DecorView is the view that actually holds the window’s background drawable. Calling getWindow().setBackgroundDrawable() from your Activity changes the background of the window by changing the DecorView‘s background drawable. As mentioned before, this setup is very specific to the current implementation of Android and can change in a future version or even on another device.

这篇关于什么是Android DecorView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆