Android User Interfaces




User Interfaces (UI) in Android can be built within two ways, by defining XML-Code or by writing Java-Code. Defining the GUI structure in XML is highly preferable, because as one knows from the Model-Viewer-Control principle that the UI should always be separated from the program-logic. Additionally adapting a program from one screen-resolution to another is a lot easier. Defining a UI in XML is very similar to creating a common HTML-document, where you have i.e. such a simple file:

<html>
<head>
<title>Page Title</title>
</head>
<body> The content of the body element. </body>
</html>

Just the same as in Android’s XML-Layouts. Everything is well structured and can be expressed by tree-structures:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
         xmlns:android="http://schemas.android.com/apk/res/android"
         android:orientation="vertical"
         android:layout_width="fill_parent"
        android:layout_height="fill_parent">
<TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hello World"/>
</LinearLayout>

Posted in . Bookmark the permalink. RSS feed for this post.

Leave a Reply

Pages

Search

Sandiah Notes Template Sandroid11.blogspot.com.