Monday, December 26, 2011

XML - Layout gist

xmlns: android This is an XML namespace declaration that tells the android tools that we are going to refer to common attributes defined in the android namespace. The outermost tag in every Android layout file must have this attribute.
android:idThis attribute assigns a unique identifier to any of the android.widget class.
android:layout_width as the name implies, its the screen width and
android:layout_height the screen height.
android:textThis sets the text that TextView should display.
res/values/strings.xmlyou use a string resource instead of a hard-coded string value.

Android - XML layout

Its a tree of XML elements, wherein each node is the name of a View class. We can use the name of any class that extends View as an element in our XML layouts, including the custom View layouts we define in our own code. This model is inspired by the web development model, where you can separate the application UI and the the programmatic logic.

Views - Android user interface layout

An android user interface has hierarchy of objects called Views.
What is a view?

It is a drawable object used as an element in your UI layout such as a button, image, textlable etc.,


What is a drawable object?

A drawable means "something that can be drawn". Most often drawable is dealt as a type of resource retrieved for drawing things to the screen. The Drawable class provides a generic API for dealing with an underlying visual resource that may take a variety of forms.

Java constructors - this() call

It is possible to use this() construct, to implement local chaining of the constructors in a class.
this() - it invokes an another constructor with the corresponding parameter list withing the same class.
But, Java requires the this() call must occur as the first statement in a constructor.