Android

adplus-dvertising
User Interface in Android
Previous Home Next

View and ViewGroup objects is used for user interface in andriod. View class is basic unit. Widgets class which offer fully implemented UI objects in android like button and text field etc which is the sub class of View class. Layouts class provides different kinds of layout architecture, like linear, tabular and relative which is the sub class of ViewGroup class.View is also a point of interaction for the user and the receiver of the interaction events. setContentView() method is used to pass a reference to the root node object that is called by the Activity.

XML is used to store and transfer the data and provides layout that is readable by the human much like HTML.. View objects are leaves in the tree, ViewGroup objects are branches in the tree .

Widgets : Android provides a set of fully implemented widgets, like buttons, checkboxes, and text-entry fields. It is a View object that serves as an interface for interaction with the user. date picker, a clock, and zoom controls are some other widget. android.widget package provides several method and class for this purpose.

Layout: Layout is the process of planning and arranging in detail something that is human readable form. <LinearLayout> element is used to creates a Linear Layout view group and TextView element creates a TextView. When you load a layout resource, the Android system initializes these run-time objects, corresponding to the elements in your layout.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android=
"http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <TextView
        android:id="@+id/label"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="Type here:"/>
    <EditText
        android:id="@+id/entry"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background=
		"@android:drawable/editbox_background"
        android:layout_below="@id/label"/>
    <Button
        android:id="@+id/ok"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/entry"
        android:layout_alignParentRight="true"
        android:layout_marginLeft="10dip"
        android:text="OK" />
    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_toLeftOf="@id/ok"
        android:layout_alignTop="@id/ok"
        android:text="Cancel" />
</RelativeLayout>

Menus: Menus offers a reliable interface that reveals application functions and settings.Android will automatically create the necessary View hierarchy for the menu and draw each of your menu items in it. You do not define this structure yourself OnCreateOptionsMenu() or onCreateContextMenu() methods for your Activity and declare the items that you want to include in your menu

Adapters: Adapters is used to bind your view to an external source of data. AdapterView is used for this purpose.

Previous Home Next