Saul
2 min readSep 28, 2017

--

Agree with the tip, but adding my point I think that because an XML constraint, some comments can’t be as meaningful as they could be because line comments don’t exist on marked based languages.

Example:

tools attribute without explanation

In that layout, I’m reusing a @layout/view_price_Header which is the same for land and portrait configurations.

The reason behind the tools:ignore attribute is that a lint its shown since the tool is not able to recognise the referred view.

That might be not understood at first sight for others, so a comment would make sense there explaining the reason.

<!-- Known at @layout/view_price_header -->

In an ideal world, I would add a comment right of that line:

tools attribute with a explanatory comment which fails on compilation

That would fail in compilation time, as after the comment, the rest of attributes will be misinterpreted.

tools attribute with a explanatory comment out of context which compiles

The only solution is to write that comment at the end of the tag, and it might appear out of context and is not meaningful as it could be.

--

--