LayoutInflater: https://blog.csdn.net/guolin_blog/article/details/121889703 LayoutInflater 将一个xml布局转换成一个View对象的过程主要包含两步: 通过解析器来将xml文件中的内容解析出来。 使用反射将解析出来的元素创建成View对象。 public View inflate(int resource, @Nullable ViewGroup root, boolean attachToRoot) { … } 如果我们将inflate()方法的第三个参数传入true,那么就会直接将inflate出来的布局添加到父布局当中。这样后面再次addView的时候就会发现它已经有一个父布局了,从而抛出RuntimeException的崩溃信息。
Understand How View Renders in Android
From: https://medium.com/better-programming/understand-how-view-renders-in-android-763f0adfb95c In this article, we’re going to see an overview of how the view we created in XML gets rendered on the screen in pixels. Making a great-performing app is only possible by knowing what’s going under the hood. If you don’t know what the hardware is doing, you have a chance of using […]