Similar to the question for eclipse,
In Window You can use Ctrl + alt + enter reformat code in your Android studio it is best way indent code properly manner
You can also enable it on save via the following preference (Editor -> General -> Other):
And for those wondering,
"Always keep trailing spaces on caret line"
If this option is selected, trailing spaces will not be stripped on the line where the caret is placed on save operation (for example, when you switch to another window).
(bigger image)
Ha, it's as simple as Code->Reformat code...
(option-cmd-L)
A simple shortcut to do this easy is just Ctrl + alt + L .