The elements in framelayout must be set
Android: layout_height and Android: layout_width
Because you only want to put components, you can set the two things to wrap_content.
So how should we locate it?
We can use layout_gravity to locate
For example, layout_gravity = "left"
Layout_gravity = "center_vertical"
Layout_gravity = "center_vertical | right", etc.
In this case, the children of the Child framelayout will automatically migrate to the gravity.
The left margin of framelayout, the upper middle margin, and so on.
So how to set the benchmark?
Set layout_gravity = "Left", and then set
Layout_marginleft = "34px"
Layout_margintop = "56px"
In this way, the child can locate the component at the position X = 34px, y = 35px.
Therefore, to set X, Y depends on Android: layout_marginleft and Android: layout_margintop.
In addition, after layout_margintop and layout_marginleft are set,
You must also set layout_gravity. If not, your margintop and marginleft
Is invalid.
Remember
Android: layout_width = xxx
Android: layout_height = xxx
And set Android: layout_gravity = "left"
If this setting is not set, it is possible that the location is not normal or the volume cannot be found, or even the compile is not found.