Why don't style and layout use the android namespace?

Example, when creating this:

    android:text="@string/hello" />


Possible reason:
style and layout get processed at compile time, but I am not 100% sure.

  • Custom Android calendarView
  • Android Error - Open Failed ENOENT
  • Importing gradle project to eclipse
  • How do I close an Android alertdialog
  • Prevent network sync loop when syncing from network in Android ContentProvider
  • How to handle “infinite” web pages?
  • EDIT:

    Same thing with package in the AndroidManifest.xml file.

  • How to Detect Physical object in Android Augmented Reality?
  • Finish all previous activities
  • com.google.android.gms.maps.MapFragment: Cannot resolve symbol “maps”
  • Android CardView with weird border when transparent
  • Android SDK manager does not download all API levels
  • Where to store global constants in an Android application?
  • One Solution collect form web for “Why don't style and layout use the android namespace?”

    Looking at the source of LayoutInflater, there doesn’t seem to be a obvious reason why it’s layout in a include tag and not android:layout. I guess since the include tag is a special case in a layout there’s no need for the android prefix.

    The include tag is not processed at compile time however, else it wouldn’t be in LayoutInflater now wouldn’t it 😉

    As for style, I don’t know for sure, but I think the reason is that namespaced attributes are defined in XML and passed as AttributeSet in the View constructor. The style however isn’t passed in that set, but as a separate parameter. So I think the reasoning is that style is a parameter that is always there, while namespace prefixed attributes are dynamic and custom for a View.

    So no definite answer from me, but maybe it helps 😉

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.