user6685522
user6685522

Reputation:

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?

Upvotes: 3

Views: 632

Answers (1)

CommonsWare
CommonsWare

Reputation: 1007399

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.

Upvotes: 4

Related Questions