1

I'm using copyright comment at the beginning of every file but there is an annoying issue with xml files in Android Studio.

Using automatic code format option (CTRL+ALT+L) places comment on the first line right after <?xml version="1.0" encoding="utf-8"?> tag like this:

wrong comment placement

What I want however is this:

correct comment placement

I'm using recommended code style for Android

Android Studio code style settings

I've tried to find the option in the settings but with no luck.

I'm pretty sure there is a way to tell the formatter to put the comment on the separate line but maybe not available via GUI toggle?

1 Answer 1

2

Well, I've found the way to keep it on a separate lines by selecting "Keep line breaks" option.

code style settings

It won't cause bad formatted comment to get on separate line but it won't break well formatted one as well so this half-solution is definitely better than nothing.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.