In Android If a control is added statically in XML first, the rest of the controls are added dynamically via AddView, so if there is a control overlay (for example, using Framelayout or Relativelayout), The controls that are added first are overwritten by the controls that are added later.
In the view class there is a method BringToFront, which has to be annotated as follows:
/**
* Change the View ' s z order in the tree, so it's on top of other sibling
* views. This ordering affect layout, if the parent container
* uses an order-dependent layout scheme (e.g., linearlayout). Prior
* To {@link Android.os.build.version_codes#kitkat} this
* method should is followed by calls to {@link #requestLayout ()} and
* {@link view#invalidate ()} on the View's parent to force the parent to redraw
* With the new child ordering.
*
* @see Viewgroup#bringchildtofront (View)
*/
As we can see, this method can change the order of the ViewGroup in the z coordinate so that the current control is at the top of all sibling controls, at the same time before 4.4, and requires its parent control to call Requestlayout () and Invalidate () To redraw the order of the child controls.
It is also important to note that you need to call BringToFront () to set the order of the specified controls after all the controls have been loaded, or else the control that you want to load will probably overwrite the control you wish to put on.
This way we can arrange the overwrite order of the child controls.
Android Control display order control