You are on page 1of 19

Mobile Programming

Engr. Waqar Ahmed

MUET, Shaheed Z.A Bhutto Campus Khairpur Mir’s


Android GUI Architecture
• The Android UI framework is, like other Java UI frameworks, organized
around the common Model-View-Controller pattern.
The Model
• The Model is the backbone of your application—what it actually
does.

• It might be, for instance, the database of music on your device


and the code for playing the music.
The View
• The View is the visualization of the Model.

• More generally, a view is the portion of the application responsible


for rendering the display, sending audio to the speakers, generating
tactile feedback, and so on.
The Controller
• The Controller is the portion of an application that responds to
external actions: a keystroke, a screen tap, an incoming call, and
so forth.

• It is implemented as an event queue.


Assembling a Graphical Interface
• The Android UI framework provides both a complete set of
drawing tools with which to build a UI, and a rich collection of
prebuilt components based on these tools.

• The MapActivity and MyLocationOverlay classes make it possible


to create extremely sophisticated applications without doing any
custom drawing at all.
Assembling a Graphical Interface
• In the Android UI framework, the widgets are all subclasses of
android.view.View.
Android Widget Toolbox
Android supplies a toolbox of standard Views to help make an
interactive interface
• TextView A standard read only text label. It supports multiline
display, string formatting, and automatic word wrapping.

• EditText An editable text entry box. It accepts multiline entry and


word wrapping.
Android Widget Toolbox
• ListView A View Group that creates and manages a group of Views used to
display the items in a List. The standard ListView displays the string value
of an array of objects using a TextView for each item.
Android Widget Toolbox
• Spinner Composite control that displays a TextView and an associated
ListView that lets you select an item from a list to display in the
textbox. It has a Text View displaying the current selection, combined
with a button that displays a selection dialog when pressed.

• Button Standard push-button


Android Widget Toolbox
• CheckBox Two-state button represented with a checked or unchecked
box.

• RadioButton Two-state grouped buttons. Presents the user with a


number of binary options of which only one can be selected at a time.
Android Widget Toolbox
• Date Picker allows you to select the date consisting of day, month
and year in your custom user interface.

• Progressbars are used to show progress of a task. For example,


when you are uploading or downloading something from the intern
et, it is better to show the progress of download/upload to the
user. In android there is a class called ProgressDialog that allows you
to create progress bar.
Layouts/ ViewGroups
Positioning of these views depend upon the android.view.ViewGroup.
The view groups are the containers of these views

• LinearLayout - displays View-elements as a single row (if it is


Horizontal) or a single column (if it is Vertical).
Layouts/ ViewGroups
• TableLayout - displays elements in the form of a table, with rows and
columns.

• RelativeLayout - each element’s position is configured relatively to other


elements.
Layouts/ ViewGroups
• AbsoluteLayout - each element is specified an absolute position on the scr
een in the coordinate system (x, y).

• ConstraintLayout - allows you to create large and complex layouts with a fla
t view hierarchy (no nested view groups). It's similar to RelativeLayout in th
at all views are laid out according to relationships between sibling views an
d the parent layout, but it's more flexible than RelativeLayout and easier to
use with Android Studio's Layout Editor.
Example
LinearLayout Code (Example)
RelativeLayout Code (Example)
AbsoluteLayout Code (Example)

You might also like