How can I make code beautiful in Android Studio as like as VSCode?

Just Press CTRL+ALT+L on Windows or Command+Option+L on Mac. The android studio will reformat all the code for you. And the good part is that it works for XML layouts as well.