Why don't style and layout use the android namespace?
Example, when creating this:
<TextView style="@style/blah" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" /> <include layout="@layout/footer" android:layout_width="fill_parent" android:layout_height="wrap_content"/>
layout get processed at compile time, but I am not 100% sure.
Same thing with
package in the
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 😉
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
So no definite answer from me, but maybe it helps 😉