当前位置:网站首页>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.
边栏推荐
猜你喜欢
2021-05-21
【pyqt】tableWidget里的cellWidget使用信号与槽机制
[STM32] actual combat 3.1 - drive 42 stepper motors with STM32 and tb6600 drivers (I)
在我有限的软件测试经历里,一段专职的自动化测试经验总结
Mpx 插件
数据库同步工具 DBSync 新增对MongoDB、ES的支持
[untitled]
PostgreSQL中的表复制
[pyqt] the cellwidget in tablewidget uses signal and slot mechanism
面试被问到了解哪些开发模型?看这一篇就够了
随机推荐
Verilog design responder [with source code]
QT document
[untitled]
uniCloud
科普达人丨一文弄懂什么是云计算?
【时间格式工具函数的封装】
数据库同步工具 DBSync 新增对MongoDB、ES的支持
What if copying is prohibited?
自律,提升自制力原来也有方法
The seventh training assignment
自动化测试框架
Graduation season | keep company with youth and look forward to the future together!
Add a self incrementing sequence number to the antd table component
Poj1821 fence problem solving Report
Avoid mutating a prop directly since the value will be overwritten whenever the parent component
2021-04-08
Compile QT project script with qmake
The use of list and Its Simulation Implementation
网络协议 概念
The opacity value becomes 1%