android view windows,Android GUI架构 – Surface/view/window/canvas之间的关系

Is Window responsible for collecting and dispatching the input?

没有。ViewRoot负责这一点。

What is the relationship between the view and window? Same as the

relationship between surface and window in DFB?

What is the relationship between an activity and window? Will each activity have a window?

是的,大部分时间。但是,SurfaceView有自己的窗口。所以,如果一个Activity有一个SurfaceView,它将有多个窗口。

Is it possible to create a window from application? And when it is necessary?

不必要。

Does Android support multi-window?

当然。使用HierachyView可以清楚地看到系统中存在多个窗口。

1.What are the responsibilities of various classes, such as Window, View, Canvas, Surface, and how do they collaborate with each other?

2.How many windows usually an Activity have?

通常一个。

3.Will all the views in one Activity will be attached to a window? What does attach mean?

4.Does every window have a surface? Does every canvas have a surface?

每个窗口都有一个表面,Surface使用Canvas来绘制表面。

5.View is responsible for managing focus/key events, while Canvas is only responsible for “drawing” operation?

是。

6.WindowManager is responsible for Window stacking? How does that relate to SurfaceFlinger?

不是WindowManager的责任。 (去做)

SurfaceFlinger用于组成与不同Window / Activity相关联的Surface。

7.View doesn’t own a Surface, the Window the view contained owns?

视图将使用Canvas在表面上绘制。视图被附加到拥有表面的窗口。

这可以通过实现一个自定义视图来理解,当你应该覆盖你的派生类中的onDraw(Canvas)方法。

8.The View draws itself using canvas got by calling surface.lockCanvas()?

是。

9.When and how is onDraw(Canvas) called, and who passes the canvas parameters?

onDraw()将被RootView调用,当调用invalidate时。 canvas参数从RootView传递。

10.Does Canvas have a size? Will a Window’s surface always be full screen?

我不能肯定地说。但是当我创建一个自定义视图时,从onDraw(Canvas)获得的画布的大小是全屏的。

但是,在我的理解,为了性能的缘故,窗口的Surface不应该总是全屏。但这个假设没有得到验证。例如,statusBar窗口不应该是全屏的。

1.Will every Activity have one ViewRoot and thus one Window?

是。

2.Is there any need to create a window explicitly? Will the surface for the window always be full screen?

不需要自己创建窗口。

3.Will status bar be in another Window?

是。

4.What is the size of the surface? Will that always be full screen?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值