Deprecated: imwpcache\f884414bce24ee67f\f73723ec7b1919fa5::__construct(): Implicitly marking parameter $YECBGYFECGEAFWHA as nullable is deprecated, the explicit nullable type must be used instead in /www/wwwroot/www.chuangxiangniao.com/wp-content/plugins/imwpcache-dist/build/f884414bce24ee67ff73723ec7b1919fa5.php on line 2

Deprecated: imwpcache\f884414bce24ee67f\f73723ec7b1919fa5::__construct(): Implicitly marking parameter $BBWFDDBHHYHDXXAB as nullable is deprecated, the explicit nullable type must be used instead in /www/wwwroot/www.chuangxiangniao.com/wp-content/plugins/imwpcache-dist/build/f884414bce24ee67ff73723ec7b1919fa5.php on line 2
理解WindowManager_创想鸟

理解WindowManager

WindowManager的关联类

理解windowmanager理解windowmanager

Window是一个抽象类,其具体实现类为PhoneWindow,负责管理View。WindowManager是一个接口类,继承自ViewManager接口,用于管理Window,其实现类为WindowManagerImpl。

可以通过WindowManager对Window(View)进行添加、更新和删除操作。WindowManager会将具体工作委托给WMS处理。WindowManager与WMS通过Binder进行跨进程通信,WMS作为系统服务,许多API不会暴露给WindowManager。

Window是以View的形式存在的。

PhoneWindow是在Activity启动过程中的attach方法中创建的。

WindowManagerImpl虽然是WindowManager的实现类,但并未实现功能,而是将功能委托给了WindowManagerGlobal,这里使用了桥接模式。

PhoneWindow继承自Window,通过setWindowManager方法与WindowManager关联。WindowManager继承自ViewManager接口,WindowManagerImpl是WindowManager接口的实现类,但具体功能由WindowManagerGlobal实现。

Window的属性

Type-Window的类型

1)应用程序窗口(Application Window),Type值范围为1~99。

2)子窗口(Sub Window),Type值范围为1000~1999。

3)系统窗口(System Window),Type值范围为2000~2999。

Type值越大,Z轴排序越靠前,越靠近用户。

Window标志-Flag

理解WindowManager

钉钉 AI 助理 钉钉 AI 助理

钉钉AI助理汇集了钉钉AI产品能力,帮助企业迈入智能新时代。

钉钉 AI 助理 21 查看详情 钉钉 AI 助理

设置Window的Flag的3种方法:

Window mWindow = getWindow();mWindow.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);Window mWindow = getWindow();mWindow.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);WindowManager.LayoutParams mWindowLayoutParams = new WindowManager.LayoutParams();mWindowLayoutParams.flags = WindowManager.LayoutParams.FLAG_FULLSCREEN;WindowManager mWindowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE);TextView mTextView = new TextView(this);mWindowManager.addView(mTextView, mWindowLayoutParams);

软键盘相关模式

理解WindowManager

Window的操作

理解WindowManager

系统窗口StatusBar的添加过程

理解WindowManager

1)ViewRootImpl的主要职责:

作为View树的根并管理View树触发View的测量、布局和绘制作为输入事件的中转站管理Surface负责与WMS进行进程间通信

2)mWindowSession是IWindowSession类型的Binder对象,用于进行进程间通信。IWindowSession是Client端的代理,其Server端的实现为Session。之前的代码逻辑运行在本地进程,而Session的addToDisplay方法则运行在WMS所在的SystemServer进程中。

理解WindowManager

3)在WMS中,会为添加的窗口分配Surface,并确定窗口显示次序。负责显示界面的是画布Surface,而不是窗口本身。WMS会将它所管理的Surface交由SurfaceFlinger处理,SurfaceFlinger会将这些Surface混合并绘制到屏幕上。

4)Window的更新需要调用ViewManager的updateViewLayout方法,updateViewLayout方法在WindowManagerImpl中实现,然后会调用WindowManagerGlobal的updateViewLayout方法。

–摘自《Android进阶解密》

以上就是理解WindowManager的详细内容,更多请关注创想鸟其它相关文章!

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/229196.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
铁路12306未出行订单在哪里找_铁路12306未出行订单查询方法
上一篇 2025年11月3日 20:26:37
一场OpenMic,聊出行业新未来
下一篇 2025年11月3日 20:26:39

相关推荐

发表回复

登录后才能评论
关注微信