当前位置:网站首页>Android 面试知识点
Android 面试知识点
2022-07-07 09:10:00 【InfoQ】
Requestlayout,OnLayout,OnDraw,DrawChild区别与联系
- requestLayout()方法 :会导致调用measure()过程 和 layout()过程 。说明:只是对View树重新布局layout过程包括measure()和layout()过程,不会调用draw()过程,但不会重新绘制任何视图包括该调用者本身。
- onLayout()方法(如果该View是ViewGroup对象,需要实现该方法,对每个子视图进行布局)
- onDraw()方法绘制视图本身 (每个View都需要重载该方法,ViewGroup不需要实现该方法)
- drawChild()去重新回调每个子视图的draw()方法。
Android为每个应用程序分配的内存大小是多少?
Android View刷新机制
- mView.draw()开始绘制,draw()方法实现的功能如下:绘制该View的背景为显示渐变框做一些准备操作。
- 调用onDraw()方法绘制视图本身 (每个View都需要重载该方法,ViewGroup不需要实现该方法)
- 调用dispatchDraw ()方法绘制子视图(如果该View类型不为ViewGroup,即不包含子视图,不需要重载该方法)值得说明的是,ViewGroup类已经为我们重写了dispatchDraw ()的功能实现,应用程序一般不需要重写该方法,但可以重载父类函数实现具体的功能。
LinearLayout对比RelativeLayout
- RelativeLayout会让子View调用2次onMeasure,LinearLayout 在有weight时,也会调用子View2次onMeasure
- RelativeLayout的子View如果高度和RelativeLayout不同,则会引发效率问题,当子View很复杂时,这个问题会更加严重。如果可以,尽量使用padding代替margin。在不影响层级深度的情况下,使用LinearLayout和FrameLayout而不是RelativeLayout。
边栏推荐
- seata 1.3.0 四種模式解决分布式事務(AT、TCC、SAGA、XA)
- Opencv installation and environment configuration - vs2017
- 学习笔记|数据小白使用DataEase制作数据大屏
- Deconstruction and assignment of variables
- 滚动踩坑--UNI_APP(八)
- Seata 1.3.0 four modes to solve distributed transactions (at, TCC, Saga, XA)
- 网络协议 概念
- Introduction to shell programming
- Table replication in PostgreSQL
- The sixth training assignment
猜你喜欢

关于jmeter中编写shell脚本json的应用

The concept, implementation and analysis of binary search tree (BST)

Avoid mutating a prop directly since the value will be overwritten whenever the parent component

Input type= "password" how to solve the problem of password automatically brought in

shardingsphere分库分表示例(逻辑表,真实表,绑定表,广播表,单表)

uniCloud

通过 Play Integrity API 的 nonce 字段提高应用安全性

Deep understanding of Apache Hudi asynchronous indexing mechanism

测试优惠券要怎么写测试用例?

The database synchronization tool dbsync adds support for mongodb and es
随机推荐
Poj1821 fence problem solving Report
vim 的各种用法,很实用哦,都是本人是在工作中学习和总结的
The fifth training assignment
A case of compiling QT file qmake compiling script
Simple and easy to modify spring frame components
The post-90s resigned and started a business, saying they would kill cloud database
Eth trunk link switching delay is too high
测试开发基础,教你做一个完整功能的Web平台之环境准备
mif 文件格式记录
The sixth training assignment
MPX plug-in
[untitled]
关于测试人生的一站式发展建议
关于在云服务器上(这里用腾讯云)安装mysql8.0并使本地可以远程连接的方法
Graduation season | keep company with youth and look forward to the future together!
2022.7.5DAY597
從色情直播到直播電商
Interprocess communication (IPC)
对比学习之 Unsupervised Learning of Visual Features by Contrasting Cluster Assignments
Wallhaven壁纸桌面版