JohnK
JohnK

Reputation: 7337

Why "android:" everywhere?

Why do Android xml layout files need android: before every single view attribute? Doesn't the system know it's Android? If the word is indeed redundant, it would seem that omitting it would save a good fraction of the memory required by these files, not to mention typing by programmers.

Upvotes: 6

Views: 171

Answers (1)

Tyler Treat
Tyler Treat

Reputation: 14998

It's used to specify that an element or attribute is part of that XML namespace. You can create your own namespaces for your own custom components (and often you will see them with 3rd party libraries). So in that regard, it's not redundant because it prevents name clashes.

Upvotes: 7

Related Questions