Let’s talk about the five commonly used methods of Window, so that you can compare them when you use them.
- setContentView: Set the content of the view. The Activity method with the same name calls getWindow().setContentView.
- setLayout: Set the width and height of the content view.
- setGravity: Set the alignment of the content view.
- setBackgroundDrawable: Set the background of the content view.
- findViewById: Get the object of the view according to the resource id. The Activity method with the same name calls getWindow().findViewById.