On Jun 13, 12:01 am, Mitch <[email protected]> wrote:
> Does anyone know a link to the specification for the XML Layout? I'm
> looking for a description of the tags etc. Since I'm new and just
> learning, a simplified version would be nice, focusing on the most
> common tags. Everything I read now is vague.
There are no common tags in XML (unlike in HTML or X-HTML which are
subclasses of XML). In case of android every subclass of View can be
an Element. You can even create your own subclasses of View and use
them in the layout XML files.
You can check for some very basics at
http://tseng-blog.nge-web.net/blog/2009/01/30/android-creating-xml-uis/
> - What does xmlns mean?
> - What does the "http://schemas.android.com/apk/res/android" do?
xmlns means Extended Markup Language (XML) namespace (NS)
It's a unique identifier/namespace. The http:// part is just the name
of this namespace. Theoretically it could also have been called
"ljkjasd09kalsdj092", as long as it's unique. Most developers who
create some schemas usually chose a URL as name. For example if you
want to use X-HTML transitional (also a subform of XML) the xmlns
would be http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd, so
(in this case) the browser knows that this document is an X-HTML 1.0
transitional file and can parse it correctly. For android keep it at
http://schemas.android.com/apk/res/android and don't change it
> - What is the android: sytnax all about?
Android is the namespace you defined above with
xmlns:android="http://schemas.android.com/apk/res/android". It tells
the compiler that it's related to android
> - Can you create your own Layouts like the "LinearLayout"?
Yes, but you have to do it in code first. You create your own class
which expands ViewGroup or one of the existing Layout classes, for
example:
class MyLayout expands LinearLayout {... }
Once you did it in code, you can use it in the XML files too, but you
have to use full qualified name of the class, like:
<org.mypackage.myproject.widgets.MyLayout ...>...</
org.mypackage.myproject.widgets.MyLayout>
instead of
<MyLayout>...</MyLayout>
> - Is there a list of available components like "Button", "TextView"?
Basically all subclasses of View
http://developer.android.com/reference/android/view/View.html
> - What does the @ symbol do?
http://developer.android.com/guide/topics/resources/available-resources.html
It tells the compiler that you want to access a resource. Here are two
differences:
If you're using android:icon="@android:drawable/someicon" then you can
access android resources (which are part of the android OS/SDK). If
you use android:icon="@drawable/someicon" (notice that the android: is
missing after the @) then you're accessing resources of your
application.
> - Can I edit this directly in Eclipse with a graphical editor rather
> than manipulating text?
Yea, you can. If you have the ADT tools installed (Android Developer
Tools). But the editor mess up with the formating so it's harder to
read it in text after it has been edited by the Editor.
> I'm sure these are probably simple questions answered somewhere, but I
> just can't find the specification and I'm so new I don't seem to be
> able to find the info.
Some Guide:
http://developer.android.com/guide/index.html
Documentation/References:
http://developer.android.com/reference/packages.html
P.S.
One thing you haven't asked, which may be important: Every Element has
different attributes (that android:text etc. inside the elements). You
can find them in the documentation of that class you're using. For
example for a <TextView ...> you have to look at the TextView class
at
http://developer.android.com/reference/android/widget/TextView.html
It will have a section called "XML Attributes" and "Inherited XML
Attributes" where you can find all valid attributes for that element.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" 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-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---