android on intel course app development - ui · android on intel course app development - ui paul...

14
Android on Intel Course App Development - UI Paul Guermonprez www.Intel-Software-Academic-Program.com [email protected] Intel Software 2013-02-08

Upload: others

Post on 03-Oct-2020

9 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Android on Intel Course App Development - UI · Android on Intel Course App Development - UI Paul Guermonprez ... You can also use anonymous implementation. Notifications The notification

Android on Intel CourseApp Development - UI

Paul Guermonprezwww.Intel-Software-Academic-Program.com

[email protected] Software

2013-02-08

Page 2: Android on Intel Course App Development - UI · Android on Intel Course App Development - UI Paul Guermonprez ... You can also use anonymous implementation. Notifications The notification

User Interface

Page 3: Android on Intel Course App Development - UI · Android on Intel Course App Development - UI Paul Guermonprez ... You can also use anonymous implementation. Notifications The notification

Views

A View is like a widget, a simple user interface element.

Views can be grouped as View Groups.

Use a Layout to arrange different views.

Fragments can group larger parts of your UI.

Page 4: Android on Intel Course App Development - UI · Android on Intel Course App Development - UI Paul Guermonprez ... You can also use anonymous implementation. Notifications The notification

Layout

Here's a simple Layout for our first Activity defined in XML :<?xml version=”1.0” encoding=”utf-8”?>

<LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android”android:orientation=”vertical”android:layout_width=”match_parent”android:layout_height=”match_parent”>

<NumberPickerandroid:layout_width=”match_parent”android:layout_height=”wrap_content”android:text=”Enter Text Below”/>

<EditTextandroid:layout_width=”match_parent”android:layout_height=”wrap_content”android:text=”Text Goes Here!”/>

</LinearLayout>

Page 5: Android on Intel Course App Development - UI · Android on Intel Course App Development - UI Paul Guermonprez ... You can also use anonymous implementation. Notifications The notification

Layouts

A layout can be attached to an Activity. It must be put in the layout folder, then you can use the name of the file to attach the layout to the Activity.

Page 6: Android on Intel Course App Development - UI · Android on Intel Course App Development - UI Paul Guermonprez ... You can also use anonymous implementation. Notifications The notification

Layouts

In the Java file, just use the setContentView function with R.layout.name_of_your_file

Same name

Page 7: Android on Intel Course App Development - UI · Android on Intel Course App Development - UI Paul Guermonprez ... You can also use anonymous implementation. Notifications The notification

Views

Views represent the graphical elements that you add in your UI.

The more elements you try to display the slower the application will be.

Page 8: Android on Intel Course App Development - UI · Android on Intel Course App Development - UI Paul Guermonprez ... You can also use anonymous implementation. Notifications The notification

Views

To add an ID to a view element, use the attribute android:id.

To retrieve you element in Java, use the findViewById function.

Page 9: Android on Intel Course App Development - UI · Android on Intel Course App Development - UI Paul Guermonprez ... You can also use anonymous implementation. Notifications The notification

Events

Everything is event

Link to listener : implements or extends

You can also use anonymous implementation

Page 10: Android on Intel Course App Development - UI · Android on Intel Course App Development - UI Paul Guermonprez ... You can also use anonymous implementation. Notifications The notification

Notifications

The notification system allows you to display messages outside of your application

Page 11: Android on Intel Course App Development - UI · Android on Intel Course App Development - UI Paul Guermonprez ... You can also use anonymous implementation. Notifications The notification

Notifications

To create a notification, you need to use a NotificationCompat.Builder object.

Then you can call the notify function from the NotificationManager.

Page 12: Android on Intel Course App Development - UI · Android on Intel Course App Development - UI Paul Guermonprez ... You can also use anonymous implementation. Notifications The notification

User Interface

In Android, an activity is attached to a XML file that describes the view.The root element of this file must be a Layout.

A Layout can contain other layouts and also views. You can attach listeners to View elements to handle events.

Page 13: Android on Intel Course App Development - UI · Android on Intel Course App Development - UI Paul Guermonprez ... You can also use anonymous implementation. Notifications The notification
Page 14: Android on Intel Course App Development - UI · Android on Intel Course App Development - UI Paul Guermonprez ... You can also use anonymous implementation. Notifications The notification

License Creative Commons - By 3.0

You are free:

to Share — to copy, distribute and transmit the work

to Remix — to adapt the work

to make commercial use of the work

Under the following conditions:

Attribution — You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work).

With the understanding that:

Waiver — Any of the above conditions can be waived if you get permission from the copyright holder.

Public Domain — Where the work or any of its elements is in the public domain under applicable law, that status is in no way affected by the license.

Other Rights — In no way are any of the following rights affected by the license:

Your fair dealing or fair use rights, or other applicable copyright exceptions and limitations; The author's moral rights; Rights other persons may have either in the work itself or in how the work is used, such as publicity or privacy rights.

Notice — For any reuse or distribution, you must make clear to others the license terms of this work. The best way to do this is with a link to this web page.

http://creativecommons.org/licenses/by/3.0/