Recently I stumbled across this article on the official Android Developer site:

It explains how you can use XML to set specific attributes of your View class.
You could, for instance, define if a text is left or right aligned within your layout.xml file of the Activity or Fragment.
You could, however, also write a setter in the Java class.

Is there a recommendation when to use the one over the other?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.