Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved. 0132130807 1 Using Android XML Resources.

Slides:



Advertisements
Similar presentations
Creating posters and flyers Lesson -IV. Editing pictures inside Office Office 2007 has tools to edit photos and pictures in the document. Office 2007.
Advertisements

Rajab Davudov. What is a Layout ? A type of resource that defines what is drawn on the screen. A type of View class whose primary purpose is to organize.
KompoZer. This is what KompoZer will look like with a blank document open. As you can see, there are a lot of icons for beginning users. But don't be.
Android User Interface
1 Introduction to the Visual Studio.NET IDE Powerpoint slides modified from Deitel & Deitel.
With Alex Conger – President of Webmajik.com FrontPage 2002 Level I (Intro & Training) FrontPage 2002 Level I (Intro & Training)
© 2008 The McGraw-Hill Companies, Inc. All rights reserved. WORD 2007 M I C R O S O F T ® THE PROFESSIONAL APPROACH S E R I E S Lesson 9 Margins and Print.
Creating Android user interfaces using layouts 1Android user interfaces using layouts.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Modify Android Objects Using.
Android: versions Note that: Honeycomb (Android v3.0) A tablet-only release Jelly Bean (Android v4.1) Released on July 09, 2012.
Use a Large Bold Type for the Main Title Use Smaller Type for the Subtitle. Above type is 96 pt, this type is 66 pt Make Authors’ names smaller. This is.
Copyright © Texas Education Agency, All rights reserved. 1 Web Technologies Website Development with Dreamweaver.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Introduction to Android (Part.
Web Technologies Website Development Trade & Industrial Education
Chapter 2: Simplify! The Android User Interface
Tip Calculator App Building an Android App with Java © by Pearson Education, Inc. All Rights Reserved.
Android Layouts. Layouts Define the user interface for an activity Layouts are defined in.xml files – within /res/layout folder – different layout can.
Understanding Hello Android 1 CS300. Activity  Similar to a form  Base class for the visual, interactive components of your application  Android API.
Website Development with Dreamweaver
10/4/2015Tables1 Spring, 2008 Modified by Linda Kenney 4/2/08.
Java Software Solutions Lewis and Loftus Chapter 10 1 Copyright 1997 by John Lewis and William Loftus. All rights reserved. Graphical User Interfaces --
CIS 205—Web Design & Development Dreamweaver Chapter 5 Using HTML Tables to Lay Out a Page.
Domain 3 Understanding the Adobe Dreamweaver CS5 Interface.
Chapter 2 The Android User Interface. Objectives  In this chapter, you learn to:  Develop a user interface using the TextView, ImageView, and Button.
Android Boot Camp for Developers Using Java, 3E
UI Resources Layout Resources String Resources Image Resources.
Application Development for mobile Devices
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved. 1 3 Welcome Application Introduction to Visual Programming.
Android Boot Camp for Developers Using Java, Comprehensive: A Guide to Creating Your First Android Apps Chapter 2: Simplify! The Android User Interface.
Chapter 5 Quick Links Slide 2 Performance Objectives Understanding Framesets and Frames Creating Framesets and Frames Selecting Framesets and Frames Using.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Introduction to Android (Part.
Demo 02 StartUpScreen Display. We would like to include a button in our demo app to "do something". In the activity_main.xml we define a "Calc" button.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Chapter 41 JavaServer Face.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved. 1 4 Designing the Inventory Application Introducing TextBox es and Button s.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Android Drawing Units and The.
1 Android Development Lean and mean introduction Based on a presentation by Mihail L. Sichitiu.
Building User Interfaces Basic Applications
 2002 Prentice Hall. All rights reserved. 1 Introduction to the Visual Studio.NET IDE Outline Introduction Visual Studio.NET Integrated Development Environment.
Today We Will Review: Operating Systems (Windows) (week 3 & 4) Starting up MS Windows Desktop and its contents Functions of the desktop components Brain.
ANDROID LAYOUTS AND WIDGETS. Slide 2 Introduction Parts of the Android screen Sizing widgets and fonts Layouts and their characteristics Buttons, checkboxes.
 You won’t write a single line of program code.  Instead, you’ll use visual programming techniques.  Visual Studio processes your actions (such as mouse.
Chapter 2: Simplify! The Android User Interface
Java FX: Scene Builder.
Open Handset Alliance.
Permeability (% of Control)
Permeability (% of Control)
Microsoft Access 2007 – Level 2
Positioning Objects with CSS and Tables
Chapter 2 – Introduction to the Visual Studio .NET IDE
Mobile Application Development Chapter 4 [Android Navigation and Interface Design] IT448-Fall 2017 IT448- Fall2017.
Chap 7. Building Java Graphical User Interfaces
Graphical User Interfaces -- Introduction
CIS 470 Mobile App Development
Android Layout Basics Topics
Mobile Computing With Android ACST 4550 Intro to Android, Part 3
Chapter 2 – Introduction to the Visual Studio .NET IDE
Mobile Computing With Android ACST 4550 Android Layouts
Building User Interfaces Basic Applications
CIS 470 Mobile App Development
Mobile Programmming Dr. Mohsin Ali Memon.
Positioning Objects with CSS and Tables
Use a Large Bold Type for the Main Title (80 pt):
Permeability (% of Control)
Use a Large Bold Type for the Main Title (80 pt):
Use a Large Bold Type for the Main Title (70 pt):
Permeability (% of Control)
Use a Large Bold Type for the Main Title (70 pt):
Android Sensor Programming
Presentation transcript:

Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Using Android XML Resources and Editors

Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved The resources (res) folder contains resources used by your application. You can add resource files in a variety of formats to these folders, such as bitmap images such as JPEG and PNG, and XML files for non- image resources. Or you can build non-image resources using the editors available for these folders. The Resource (res) Folder

Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved You can create an entire Android project without building any of your GUI in Java code. You can build all of your GUI components using the Android Layout editor. To use this editor, open up the layout folder, and then double click on the XML file that is in that folder, which in the case shown here is “activity_salution.xml” The Resource (res) Folder

Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved The Layout Editor is the tool used to modify and add GUI components to your application. You can edit the Layout components using both a GUI editor and an XML editor. Whether you use the GUI or the XML editor, both editors modify an XML file that holds the description of the Layout. They are both changes the same file, but the different editors give you a different approach to making the same changes. You can make changes in either editor and then switch back to other one to see that it has been changed also. The Layout Editor

Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Using the Palette, you can choose different types of components to add to your GUI. The components are organized in folders according to their type. And you just drag and drop them out of the folder to add them to your GUI. The Layout Editor

Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved When you click on a component, you will see its attributes (or properties) listed in a Properties window on the side. From there you can change the values of the attributes you see. The Layout Editor

Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved This is the editor used to edit XML code. When looking at the XML code you are looking at all of the properties of a particular component, and you are seeing the exact attribute values and units that are used to manage that component. This is at times preferable to seeing the component only in the GUI editor because it is easy to miss details, and harder to modify some details when you are primarily in the drag and drop mode (although you can edit properties in the Properties window as well). The XML Editor

Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved  There are six basic units to use when identifying distance on the Android Screen: px, in, mm, pt, dp, and sp –px - Pixels - corresponds to actual pixels on the screen. –in - Inches - based on the physical size of the screen. –mm - Millimeters - based on the physical size of the screen. –pt - Points - 1/72 of an inch based on the physical size of the screen. –dp - Density-independent Pixels - an abstract unit that is based on the physical density of the screen (see next slide) –sp - Scale-independent Pixels - this is like the dp unit, but it is also scaled by the user's font size preference (see next slide). Drawing Units

Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved  dp - Density-independent Pixels - an abstract unit that is based on the physical density of the screen. These units are relative to a 160 dpi screen, so one dp is one pixel on a 160 dpi screen. The ratio of dp-to-pixel will change with the screen density, but not necessarily in direct proportion. Note: The compiler accepts both "dip" and "dp", though "dp" is more consistent with "sp".  sp - Scale-independent Pixels - this is like the dp unit, but it is also scaled by the user's font size preference. It is recommend you use this unit when specifying font sizes, so they will be adjusted for both the screen densityand user's preference. Drawing Units

Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Android projects do not use the standard Java Layout Manager. Instead, for the Android, each type of container supports a particular strategy for laying out its components. There are also standard ‘layouts’ that you can overlay onto multiple items: LinearLayout In a LinearLayout components are arranged in a row horizontally or in a column vertically. If there is not enough space, the ones on the end (right or bottom) may not show at all. More complex layouts can be constructed by putting horizontal LinearLayout’s inside vertical a LinearLayout. This lets the designer set up a rough grid of components. Android Layouts

Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved RelativeLayout The RelativeLayout holds components directly but arranges components based on specified relationships among the placements of components. For example, one component can be a specified distance below another component. Or, a component can have its left edge lined up with the left edge of another component. Relationships can be specified with the edges of the layout itself. The RelativeLayout is very flexible, but can be tricky to use. TableLayout While the TableLayout can hold components directly, it is more often used by putting TableRow’s inside and then putting components inside the TableRow’s. This has somewhat the same effect as putting LinearLayout’s inside LinearLayout’s with one major difference: the components in different rows are lined up in columns. Layouts

Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved The View for the Android Calculator App is completed using the Layout Editors, and now you can implement the functionality of the app using EvaluateExpression.java as a Model, and CalculatorActivity.java as the Controller. See activity_salutation.xml See SalutationActivity.java The Android Salutation App

Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved The View for the Android Simple Calculator App is completed using the Layout Editors, and now you can implement the functionality of the app using EvaluateExpression.java as a Model, and SimpleCalculatorActivity.java as the Controller. See activity_simplecalculator.xml See EvaluateExpression.java See SimpleCalculatorActivity.java The Android Simple Calculator App