[英]Performance: Android views generated programmatically vs xml views
Suppose I want to inflate 50 views inside my fragment/activity/app programmatically. 假设我想以编程方式在我的片段/活动/应用程序中填充50个视图。
Compared to xml, does generating views programmatically in Android affect the performance of that particular fragment/activity/app? 与xml相比,Android中以编程方式生成视图是否会影响特定片段/活动/应用的性能?
If no then would there be any visible effect? 如果否,那会有什么明显的影响? If yes then can you please explain why? 如果是,那么您能解释一下原因吗?
The performance is not affected, but each has its pros and cons. 性能不会受到影响,但是每个都有优点和缺点。 Just to name a few: 仅举几个:
XML XML
Pros 优点
Cons 缺点
Programatically 编程方式
Pros 优点
Cons 缺点
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.