当前位置:网站首页>Android interview knowledge points
Android interview knowledge points
2022-07-07 11:17:00 【InfoQ】
Requestlayout,OnLayout,OnDraw,DrawChild Differences and connections
- requestLayout() Method : Will result in a call to measure() The process and layout() The process . explain : Just for View Rearrange the tree layout The process includes measure() and layout() The process , Not invoke draw() The process , But no view will be redrawn, including the caller itself .
- onLayout() Method ( If it's time to View yes ViewGroup object , This method needs to be implemented , Layout each subview )
- onDraw() Method to draw the view itself ( Every View You need to overload the method ,ViewGroup There is no need to implement this method )
- drawChild() Go back to the draw() Method .
Android How much memory is allocated for each application ?
Android View Refresh mechanism
- mView.draw() Began to draw ,draw() The functions of the method are as follows : Draw the View Do some preparatory operations for displaying the gradient box .
- call onDraw() Method to draw the view itself ( Every View You need to overload the method ,ViewGroup There is no need to implement this method )
- call dispatchDraw () Method to draw a subview ( If it's time to View Type is not ViewGroup, That is, it does not contain sub views , There is no need to overload the method ) It's worth noting that ,ViewGroup Class has been overridden for us dispatchDraw () Function realization of , Applications generally do not need to override this method , But you can overload the parent function to achieve specific functions .
LinearLayout contrast RelativeLayout
- RelativeLayout Will let son View call 2 Time onMeasure,LinearLayout There is weight when , Will also call the sub View2 Time onMeasure
- RelativeLayout The son of View If the height and RelativeLayout Different , It will lead to efficiency problems , space in between View When it's complicated , This problem will be more serious . If possible , Use as much as possible padding Instead of margin. Without affecting the depth of the hierarchy , Use LinearLayout and FrameLayout instead of RelativeLayout.
边栏推荐
- [untitled]
- oracle常见锁表处理方式
- Idea shortcut keys
- [untitled]
- [STM32] actual combat 3.1 - drive 42 stepper motors with STM32 and tb6600 drivers (I)
- Still cannot find RPC dispatcher table failed to connect in virtual KD
- From pornographic live broadcast to live broadcast E-commerce
- Web端自动化测试失败的原因
- 使用MeterSphere让你的测试工作持续高效
- 解决VSCode只能开两个标签页的问题
猜你喜欢
Table replication in PostgreSQL
关于测试人生的一站式发展建议
Deeply understand the characteristics of database transaction isolation
對比學習之 Unsupervised Learning of Visual Features by Contrasting Cluster Assignments
普通测试年薪15w,测试开发年薪30w+,二者差距在哪?
Opencv installation and environment configuration - vs2017
关于SIoU《SIoU Loss: More Powerful Learning for Bounding Box Regression Zhora Gevorgyan 》的一些看法及代码实现
VR development optimization
[pyqt] the cellwidget in tablewidget uses signal and slot mechanism
RationalDMIS2022 高级编程宏程序
随机推荐
测试开发基础,教你做一个完整功能的Web平台之环境准备
技术分享 | 抓包分析 TCP 协议
uniCloud
Arduino board description
使用引用
自动化测试框架
Shardingsphere sub database and table examples (logical table, real table, binding table, broadcast table, single table)
Qt 实现容器的DELETE的方式
使用MeterSphere让你的测试工作持续高效
面试被问到了解哪些开发模型?看这一篇就够了
Which securities company is the best and safest to open an account for the subscription of new shares
如何在博客中添加Aplayer音乐播放器
Mpx 插件
How to remove addition and subtraction from inputnumber input box
Deeply understand the characteristics of database transaction isolation
Vscode 尝试在目标目录创建文件时发生一个错误:拒绝访问【已解决】
Poj1821 fence problem solving Report
普通测试年薪15w,测试开发年薪30w+,二者差距在哪?
V-for img SRC rendering fails
Activity生命周期