Android WindowManager窗口类型


从WindowManagerService角度看,一个窗口并不是Window类,而是一个View类。WindowManagerService收到用户消息后,需要把消息派发到窗口,View类本身并不能直接接收WindowManagerService传递过来的消息,真正接收用户消息的必须是IWindow类,而实现IWindow类的是ViewRoot.W类,每一个W内部都包含了一个View变量。

WmS并不介意该窗口(View)是属于哪个应用程序的,WmS会按一定的规则判断哪个窗口处于活动状态,然后把用户消息给W类,W类再把用户消息传递给内部的View变量,剩下的消息处理就由View对象完成。

WindowManager的LayoutParams中窗口类型与定义:

frameworks\base\core\java\android\view\WindowManager.java

/**

  • Start of window types that represent normal application windows.

  • ZMS:首个普通应用窗口

*/

public static final int FIRST_APPLICATION_WINDOW = 1;

/**

  • Window type: an application window that serves as the “base” window

  • of the overall application; all other application windows will

  • appear on top of it.

  • In multiuser systems shows only on the owning user’s window.

  • ZMS:基础窗口-其他应用窗口会显示在此窗口之上

*/

public static final int TYPE_BASE_APPLICATION = 1;

/**

  • Window type: a normal application window. The {@link #token} must be

  • an Activity token identifying who the window belongs to.

  • In multiuser systems shows only on the owning user’s window.

  • ZMS:普通应用窗口-此窗口需要归属于Activity,多用户系统中仅仅在对应用户的窗口中显示

*/

public static final int TYPE_APPLICATION = 2;

/**

  • Window type: special application window that is displayed while the

  • application is starting. Not for use by applications themselves;

  • this is used by the system to display something until the

  • application can show its own windows.

  • In multiuser systems shows on all users’ windows.

  • ZMS:应用启动窗口-应用启动显示的窗口,不受应用本身控制。由系统在应用显示应用本身的窗口之前显示。

*/

public static final int TYPE_APPLICATION_STARTING = 3;

/**

  • End of types of application windows.

  • ZMS:终极应用窗口-所有Activity默认的窗口类型都是TYPE_APPLICATION,

  • WindowManagerService在进行窗口叠加时,会动态改变应用窗口的层值,但不会大于99。

*/

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值