Android on Intel Course App Development - UI · Android on Intel Course App Development - UI Paul...

Post on 03-Oct-2020

11 views 0 download

Transcript of Android on Intel Course App Development - UI · Android on Intel Course App Development - UI Paul...

Android on Intel CourseApp Development - UI

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

paul.guermonprez@intel.comIntel Software

2013-02-08

User Interface

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.

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>

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.

Layouts

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

Same name

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.

Views

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

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

Events

Everything is event

Link to listener : implements or extends

You can also use anonymous implementation

Notifications

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

Notifications

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

Then you can call the notify function from the NotificationManager.

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.

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/