• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

A question about XML in Android

 
Ranch Hand
Posts: 36
1
Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I read in an Android tutorial that :

"In general, the XML vocabulary for declaring UI elements closely follows the structure and
naming of the classes and methods, where element names correspond to class names and
attribute names correspond to methods. In fact, the correspondence is often so direct that you can
guess what XML attribute corresponds to a class method, or guess what class corresponds to a
given xml element"

And

"Each layout file must contain exactly one root element, which must be a View or ViewGroup
object"

My Question is this : Why in XML layout files in res folder that i have seen there are no View or ViewGroup root element ???

Like this XML layout file :
 
Rancher
Posts: 43081
77
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
LinearLayout extends ViewGroup (as do all the other layout), so it is a ViewGroup for the purposes of a layout file. By that rationale, it is actually superfluous to mention ViewGroup there, because ViewGroup extends View - but maybe abstracting over two levels was too much for the documentation authors :-)
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic