Download presentation
Presentation is loading. Please wait.
1
By: Jeremy Smith
2
Introduction Droid Draw Add XML file Layouts LinearLayout RelativeLayout Objects Notifications Toast Status Bar Dialog Menus Events Listeners Handlers Focus Source
3
In Android, the UI is built using View and ViewGroup objects. Views are a base for subclasses called “Widgets,” which offer fully implemented UI objects. (Ex. Text fields and buttons) ViewGroups are a base for “layouts,” which offer different kinds of layout architectures. Android GUI’s are coded in a version of XML and are based on the Views and ViewGroups.
5
Add an Android specific XML file to a project. 1. In your android project open up the res folder. 2. Then open the layout folder and you will see a generic file called main.xml 3. To add a XML file simply right click and add a new file. Under Android select the Android XML file and you have a brand new XML file open to edit in your project.
6
Writing XML ( Android has its own XML vocabulary ) Used for designing UI layouts and screen elements Each layout must have only one root element. (parent) After you create an initial layout you can add additional layouts and widgets to the layout. (child objects) Position, Size, Padding and Margins Ex. getLeft(), getHight(), getPadding()
7
RelativeLayout LinearLayout
8
The visual UI elements to be used on your Application screen. Includes Buttons, Images, dialog and many other objects. Interfaces & Classes Interfaces & Classes
9
In the java source code In the XML layout
10
For a situation where you may need to notify a user about an event from your application 3 Types Toast Notification ▪ Brief message that comes form the background Status Bar Notification ▪ Background reminders that request the user’s response Dialog Notification ▪ Activity-related notifications, sometimes require an user interaction. Toast NotificationStatus Bar Notification Dialog Notification
11
Initiating a Toast object Initiate toast from the source code Or by chaining methods
12
How to create a status bar notification: 1. Reference the NotificationManager: 2. Instantiate the Notification: 3. Define the Notification's expanded message and Intent: 4.Pass the Notification to the NotificationManager:
13
Types of Dialogs AlertDialog ▪ Can have buttons, selectable items, and text dialog. ProgressDialog ▪ Displays a wheel or progress bar, also supports buttons. DatePickerDialog ▪ Allows user to select a date. TimePickerDialog ▪ Allows user to select a time. CustomDialogs ▪ Create your own dialog to suit your needs. Examples Examples
14
Allows users to access application functions and settings. 3 Types of menus Options Menu ▪ Appear when user presses the hard MENU button ▪ Two Types ▪ Icon Menu ▪ Expanded Menu Context Menu ▪ Floating list of menu items, appears after a long-press on an item. Submenu ▪ Floating list of menu items that the user opens by pressing a menu item in the Options Menu or context menu. Example Menus Example Menus
15
http://developer.android.com/guide/topics/ui/ index.html
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.