1 / 15

Android GUI

By: Jeremy Smith. Android GUI. Table of Contents. Introduction Droid Draw Add XML file Layouts LinearLayout RelativeLayout Objects Notifications Toast Status Bar Dialog Menus Events Listeners Handlers Focus Source. Introduction.

Download Presentation

Android GUI

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. By: Jeremy Smith Android GUI

  2. Table of Contents • Introduction • Droid Draw • Add XML file • Layouts • LinearLayout • RelativeLayout • Objects • Notifications • Toast • Status Bar • Dialog • Menus • Events • Listeners • Handlers • Focus • Source

  3. Introduction • 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.

  4. Droid Draw (www.droiddraw.org)

  5. Adding XML Files • Add an Android specific XML file to a project. • In your android project open up the res folder. • Then open the layout folder and you will see a generic file called main.xml • 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. Layouts • 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. Common Layouts LinearLayout RelativeLayout

  8. Widgets • The visual UI elements to be used on your Application screen. • Includes Buttons, Images, dialog and many other objects. • Interfaces & Classes

  9. How To Create a Button • In the java source code • In the XML layout

  10. Notifications • 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 Notification Status Bar Notification • Dialog Notification

  11. Toast Notification • Initiating a Toast object • Initiate toast from the source code • Or by chaining methods

  12. Status Bar Notifications • How to create a status bar notification: • Reference the NotificationManager: • Instantiate the Notification: • Define the Notification's expanded message and Intent: 4. Pass the Notification to the NotificationManager:

  13. Dialog Notifications • 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

  14. Creating Menus • 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

  15. Source • http://developer.android.com/guide/topics/ui/index.html

More Related