Yahel wrote:
> Pretty harsh answer Mark,
True, but XML namespaces have been around for quite some time. The
reasons for them are well-documented, if sporadically controversial.
Moreover, the OP wasn't seeking solutions, but rather a change in the
implementation ("Is there any plan to eliminate the requirement to add
the 'android:' namespace to attributes in layout files?"). IMHO, this
issue isn't in the top 1,000 things the core Android team needs to be
worrying about, if it's even a good idea (which is far from a given).
You, at least, seem to be asking for ways to scratch your itch, which
IMHO is the right tack to take. Maybe you'll come up with something that
can be widely adopted by the community. Maybe that solution can
eventually be folded into the AOSP.
> So if someone knows of a solution to declare the namespace once and
> for all at the top of the file or something that would be great.
You can try to see if you can get the default namespace to work
(xmlns="http://...") reliably. I get warnings on that regarding id vs.
android:id, so I am skeptical that it will hold up.
> Anyway, just my opinion, but I always found xml to be way to
> complicated for most of the task I use it for, and in Android it feels
> exactly the same. Killing a fly with truck :D
You haven't created your own custom widgets, then, at which point the
namespaces become very important for your custom attributes.
That being said, you could:
-- use a tool like Eclipse or MOTODEV Studio for Android that creates
the XML for you, at least for some types of XML.
-- write yourself a tool that injects all the missing android: on the
attributes to the XML, and add that to your build chain.
-- write your resources in JSON (or YAML or...) and create your own
inflater mechanism for each.
-- write your resources in JSON (or YAML or...) and create a tool that
generates the XML for you.
-- skip the layouts entirely and write your UIs in pure Java.
-- perhaps you can create a TextMate bundle that automates some of this,
if you're an OS X guy. I don't use TextMate, and so it's unclear how
sophisticated these bundles can get, but I'm under the impression
they're quite popular.
I'm sure there are other workarounds as well, none of which require a
minute of core Android team development time, which is my primary
concern on this topic.
So, I am sorry for the need for the tone, but right now, core Android
team time is more precious than gold, jewels, or even inkjet ink. :-)
--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy
Android App Developer Training: http://commonsware.com/training
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en