Nothing Nothing -4 years ago 178
Android Question

Why Android use separate xmlns for ContraintLayout

I'm little confused about ConstraintLayout in Android. I was learning about it and first thing I get confused about it why android use separate xml namespace for it?

xmlns:app="http://schemas.android.com/apk/res-auto"


ConstraintLayout is part of Layout then why google didn't added it in the old namespace?
xmlns:android="http://schemas.android.com/apk/res/android"


and why android required to write full qualified name in XML?
android.support.constraint.ConstraintLayout
why not just ConstraintLayout? as RelativeLayout?

Answer Source

ConstraintLayout is part of Layout then why google didn't added it in the old namespace?

That is reserved for platform-defined attributes. ConstraintLayout is from a library, not from the platform.

and why android required to write full qualified name in XML? android.support.constraint.ConstraintLayout why not just ConstraintLayout?

Android only knows to look in a couple of platform-defined packages for views using the shorthand, bare-class-name-only notation. android.support.constraint is from a library, not the platform.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download