I want to put a layout in the center of the screen.
It seems that the trend in Android now is to use a Constraint layout. Although it is simple enough to center a view using a RelativeLayout
(as other answers have shown), the ConstraintLayout
is more powerful than the RelativeLayout
for more complex layouts. So it is worth learning how do do now.
To center a view, just drag the handles to all four sides of the parent.