当前位置:网站首页>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.
边栏推荐
- Basic knowledge of process (orphan, zombie process)
- Shardingsphere sub database and table examples (logical table, real table, binding table, broadcast table, single table)
- 基于华为云IOT设计智能称重系统(STM32)
- Qt 实现容器的DELETE的方式
- How to use cherry pick?
- Unity script generates configurable files and loads
- 【C#】WinForm运行缩放(变糊)的解决方法
- Activity生命周期
- Drive HC based on de2115 development board_ SR04 ultrasonic ranging module [source code attached]
- Arduino receives and sends strings
猜你喜欢
[C #] the solution of WinForm operation zoom (blur)
Mysql的json格式查询
Interprocess communication (IPC)
對比學習之 Unsupervised Learning of Visual Features by Contrasting Cluster Assignments
[untitled]
How to remove addition and subtraction from inputnumber input box
高考作文,高频提及科技那些事儿……
技术分享 | 抓包分析 TCP 协议
PostgreSQL中的表复制
Basic knowledge of process (orphan, zombie process)
随机推荐
Qtcreator sets multiple qmake
使用MeterSphere让你的测试工作持续高效
Which securities company is the best and safest to open an account for the subscription of new shares
Antd select selector drop-down box follows the scroll bar to scroll through the solution
Static semantic check of clang tidy in cicd
Poj1821 fence problem solving Report
The seventh training assignment
Interprocess communication (IPC)
Vuthink proper installation process
Transaction rolled back because it has been marked as rollback only
通过 Play Integrity API 的 nonce 字段提高应用安全性
Mpx 插件
关于SIoU《SIoU Loss: More Powerful Learning for Bounding Box Regression Zhora Gevorgyan 》的一些看法及代码实现
Still cannot find RPC dispatcher table failed to connect in virtual KD
The sixth training assignment
Shardingsphere sub database and table examples (logical table, real table, binding table, broadcast table, single table)
请问申购新股哪个证券公司开户是最好最安全的
[untitled]
[STM32] actual combat 3.1 - drive 42 stepper motors with STM32 and tb6600 drivers (I)
[untitled]