Anda di halaman 1dari 12

Website : http://www.acadgild.

com copyright ACADGILD


LinkedIn : https://www.linkedin.com/company/acadgild
Facebook : https://www.facebook.com/acadgild

1
Session 2 Android Fundamentals &
User Interface Design
Android
CourseDevelopment
Title
copyright ACADGILD
2
Agenda Android Fundamentals & User Interface Design

1. Resources

2. Resource Type

3. Android Application Component Activity

4. User Interface Design

5. User Interface Layout

6. Layout

7. Example Program Layout, UI Components

copyright ACADGILD Android Development 3


Resources
Some attributes have values that can be displayed to users for example, a
label and an icon for an activity. The values of these attributes should be
localized and therefore set from a resource or theme.
Resource values are expressed in the following format,
@[package:]type:name
where the package name can be omitted if the resource is in the same package
as the application.
type is a type of resource such as "string" or "drawable" and
name is the name that identifies the specific resource.
For example:
<activity android:icon="@drawable/smallPic" . . . >
Values from a theme are expressed in a similar manner, but with an initial '?'
rather than '@':
?[package:]type:name

copyright ACADGILD Android Development 4


Resources Type
Animation Resources
Define pre-determined animations.
Tween animations are saved in res/anim/ and accessed from the R.anim class.
Frame animations are saved in res/drawable/ and accessed from
the R.drawable class.
Color State List Resource
Define a color resources that changes based on the View state.
Saved in res/color/ and accessed from the R.color class.
Drawable Resources
Define various graphics with bitmaps or XML.
Saved in res/drawable/ and accessed from the R.drawable class.
Layout Resource
Define the layout for your application UI.
Saved in res/layout/ and accessed from the R.layout class.

copyright ACADGILD Android Development 5


Resources Type
Menu Resource
Define the contents of your application menus.
Saved in res/menu/ and accessed from the R.menu class.
String Resources
Define strings, string arrays, and plurals (and include string formatting and
styling).
Saved in res/values/ and accessed from the R.string, R.array, and R.plurals classes.
Style Resource
Define the look and format for UI elements.
Saved in res/values/ and accessed from the R.style class.
More Resource Types
Define values such as booleans, integers, dimensions, colors, and other arrays.
Saved in res/values/ but each accessed from unique R sub-classes (such
as R.bool, R.integer, R.dimen, etc.).

copyright ACADGILD Android Development 6


Android Application Component - Activity
Activity:

Every screen in an Android app is


an Activity.
Activity will always have a User
Interface (abbreviated as UI).

It is not possible to have an Activity


without a UI.

copyright ACADGILD Android Development 7


User Interface Design
1. Your app's user interface is everything that the user can see and interact
with.

2. Android provides a variety of pre-build UI components such as structured


layout objects and UI controls that allow you to build the graphical user
interface for your app.

3. Android also provides other UI modules for special interfaces such as


dialogs, notifications, and menus.

4. Layout defines the visual structure for a user interface.

copyright ACADGILD Android Development 8


User Interface Layout
The user interface for each component of your app is defined using a hierarchy
of View and ViewGroupobjects.

copyright ACADGILD Android Development 9


Layout
Linear Layout
A layout that organizes its children
into a single horizontal or vertical
row.
It creates a scrollbar if the length of
the window exceeds the length of
the screen.

Relative Layout
Enables you to specify the location
of child objects relative to each
other (child A to the left of child B)
or to the parent (aligned to the top
of the parent).

copyright ACADGILD Android Development 10


Example Program Layout, UI Components
TextView - This control is used to display
text to the user.

Button - A push-button that can be pressed,


or clicked, by the user to perform an
action.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/a
ndroid"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="I am a TextView" />
<Button android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="I am a Button" />
</LinearLayout>

copyright ACADGILD Android Development 11


Lets Discuss Assignments
ACADGILD
copyright ACADGILD Android Development 12

Anda mungkin juga menyukai