Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
动态添加视图(使用 ViewGroup 的添加/删除视图方法)或将它们放入静态布局 xml 文件并让它编译成二进制形式并在运行时膨胀(常规方式)在性能方面会有什么差异?
我知道 ViewStub 是一种选择,但我想知道根本不充气是否有区别。
谢谢
以编程方式添加视图更快。从布局 XML 添加视图时,它以相同的方式添加它们,但此外,它需要遍历该 XML 并使用大量反射。
但这需要更多的开发人员负担:)