[Solved] How to make views aligned on any device in Android studio


You have to add constraints to your Button in order to make sure that it’s centered on every device. To do this, constrain the button’s left edge to the parent’s left edge, and constrain the button’s right edge to the parent’s right edge.

To do this in the layout editor, click and hold on the little dot on either side of your Button, and then drag that dot to the parent’s edge. This will add the constraint for you.

Alternatively, you can add constraints in the xml. In this case, you would add these:

app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"

solved How to make views aligned on any device in Android studio