Considering some applications, and wondered about onCreateView. So I understand it in it, we create our views for our fragment, say?
The onCreateView(...) method calls the inflate(...) method of some object of the LayoutInflater class:
View view = inflater.inflate(R.layout.%LAYOUT_ID%, container, false);
This method converts a markup xml file (tree of elements) into an object of class View , which can be explicitly converted to the root element of the xml file.
In this case, as a rule, this object is actually a subclass of the View class, and not directly to them. For example, it can be an object of the class LinearLayout or FrameLayout .
Further, by calling the view.findViewById(...) method, the children of the view are traversed until they find a widget with the specified identifier. When the widget is found, the view.findViewById(...) method returns it (as an object of the View class, which is then explicitly cast to the desired type).
Is it possible that, because of the large number of views in our fragment, we will overlap them with each other? If so, how to avoid this?
Yes, perhaps not necessarily because of their large number.
All screen elements can be positioned either relative to the parent view, or relative to other views that are at the same level, or relative to the first and second at the same time (this depends on the parent container).
In order not to overlap the elements with each other, it is necessary to position them correctly by setting one or another positioning attribute.
onCreateView()method will not affect this in any way. - pavlofff