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

Slides:



Advertisements
Similar presentations
HTML TABLES EXPLAINED. What is a TABLE? The HTML table allows web designers to arrange & organize data -- text, images, hyperlinks, forms, form fields,
Advertisements

Use Tables for Layout Control Day 7. You will learn to: Understand Tables Create a Simple Table Modify Your Tables Appearance Create Page Layouts with.
Chapter 3 – Web Design Tables & Page Layout
Copyright © 2004 ProsoftTraining, All Rights Reserved. Lesson 6: HTML Tables.
Internet Basics & Way Beyond!
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.
Android UserInterfaces Nasrullah Niazi. overView All user interface elements in an Android app are built using View and ViewGroup objects. A View is an.
Who Am I And Why Am I Here I’m professor Stephen Fickas in CIS – you can call me Steve. I have a research group that works with mobile devices (since 1995!)
Using HTML Tables.
HTML. Creating a Table Attributes: border: indicates the border type of the table Value: 0 (no border), 1, 2, etc. cols: indicates the number of columns.
INTRODUCTION TO WEB DEVELOPMENT AND HTML Lecture 06: Tables - Spring 2011.
Using HTML to Create Tables in Web pages Connie Lindsey November 2005.
HTML Essentials Tables and Table Tags. Overview Use of Tables goes beyond tabulating data Frequently used to format Web pages / control layout Especially.
Android: Layouts David Meredith
Identifies the Structure Table Row Column 1 Table Heading Column 2.
A table is an arrangement of data (words and numbers) in rows and columns. Tables range in complexity from those with only two columns and a title to.
1 The Structure of a Web Table beginning of the table structure first row of three in the table end of the table structure table cells You do not need.
Creating Android user interfaces using layouts 1Android user interfaces using layouts.
Android Development: Application Layout Richard S. Stansbury 2015.
CHAPTER 11 Tables. How Are Tables Used Data Display  Very tidy and very useful Better Text Alignment  Putting text in tables allows you to format indents.
HTML, Third Edition--Illustrated Introductory 1 HTML, Third Edition Illustrated Introductory Unit F Working with Tables.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Introduction to Android (Part.
PROG Mobile Java Application Development PROG Mobile Java Application Development Developing Android Apps: Components & Layout.
Web Technologies Website Development Trade & Industrial Education
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.
ANDROID – INTERFACE AND LAYOUT L. Grewe. Interfaces: Two Alternatives Code or XML  You have two ways you can create the interface(s) of your Application.
Understanding Hello Android 1 CS300. Activity  Similar to a form  Base class for the visual, interactive components of your application  Android API.
Frank Xu Gannon University.  Linear Layout  Relative Layout  Table Layout.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Using Android XML Resources.
XP New Perspectives on Microsoft Word 2002 Tutorial 31 Microsoft Word 2002 Tutorial 3 – Creating a Multiple-Page Report.
WORKBOOK FORMATTING Nolan Tomboulian Tomboulian.wikispaces.com HOW THINGS LOOK CELL COLORFONT COLOR CELL BORDERSFONT SIZE CELL SIZEFONT.
 Definition  Components  Advantages  Limitations Contents  Introduction Introduction  Inserting a Table Inserting a Table  Drawing a Table Drawing.
UI Resources Layout Resources String Resources Image Resources.
User Interfaces: Part 1 (View Groups and Layouts).
Application Development for mobile Devices
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.
TABLES 1. In this chapter you will learn that tables have many uses in HTML. Objectives: Upon completing this section, you should be able to: 1. Insert.
Kevin Murphy Introduction to Tables Masters Project CS 490.
CIS234A- Lecture 7 Instructor Greg D’Andrea. Tables A table can be displayed on a Web page either in a text or graphical format. A text table: – contains.
Tables in HTML. Table Tag HTML tables always begin and end with a table tag. Syntax:
Computer Science 101 Lists and Tables. Lists Unordered lists - use a bullet Ordered lists - use a number, Roman numeral, or letter.
Copyright (c) 2004 Prentice-Hall. All rights reserved. 1 Committed to Shaping the Next Generation of IT Experts. Project 5: Working with Tables Kelly L.
Unit 4 Create and Use Tables. TITLE CORNELL NOTES TOPIC: NOTES: Name: Date: 09/08/2009 Period : Summary: Reasons for using tables Unit 4 Page 1 Display.
ANDROID – DRAWING IMAGES – SIMPLE EXAMPLE IN INTERFACE AND EVENT HANDLING L. Grewe.
1 Android Development Lean and mean introduction Based on a presentation by Mihail L. Sichitiu.
CS378 - Mobile Computing User Interface Basics. User Interface Elements View – Control – ViewGroup Layout Widget (Compound Control) Many pre built Views.
Web Page Tables GMU-Teaching with Technology. Table Characteristics: Looks like a news page Contains columns and rows.
Building User Interfaces Basic Applications
BUILDING A SIMPLE USER INTERFACE. In this lesson, you create a layout in XML that includes a text field and a button. In the next lesson, your app responds.
ANDROID LAYOUTS AND WIDGETS. Slide 2 Introduction Parts of the Android screen Sizing widgets and fonts Layouts and their characteristics Buttons, checkboxes.
HTML  HyperText Markup Language  The Language used to design web pages  Code mixed with text  Tags enclosed in angle brackets  Single tags  Paired.
CNIT 131 HTML5 - Tables.
Mobile Software Development for Android - I397
LAB Work 02 MBA 61062: E-Commerce
Mobile Application Development Chapter 4 [Android Navigation and Interface Design] IT448-Fall 2017 IT448- Fall2017.
H T M L A B E S X P I N D.
HNDIT2417 Mobile Application Development
CIS 470 Mobile App Development
Android Layout Basics Topics
Lecture 2 b: Android Layout Basics Topics
Mobile Computing With Android ACST 4550 Android Layouts
Android Studio Constraint Layout
Building User Interfaces Basic Applications
CIS 470 Mobile App Development
H T M L A B E S X P I N D.
CS 240 – Advanced Programming Concepts
Android Sensor Programming
Presentation transcript:

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

Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Most Android projects that have GUIs that are built using the Layout editor use one of the following Layouts: RelativeLayout, Linear Layout, and TableLayout. Each of these layouts have attributes or properites that help you design certain types of GUIs. The attributes can be seen in the XML file for the layout with the word “android:” in front of them. These attributes are the standard Android attributes that you can control from XML or from within Java methods. Android Layouts

Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved To modify an Android view component’s attributes from XML, you just open up the XML file and change it from within the XML tags. To modify the component’s attributes from Java code you must use the components ID value and then load it using findViewById() as shown below for a TextView and a Button: TextView txtViewName = (TextView) findViewById(R.id.txtViewName); Button btnName = (Button) findViewById(R.id.btnName); Then you can access or change an attribute like the background color of the object using the its accessor and mutator methods: txtViewName.setBackgroundColor(someColor); btnName.setBackgroundColor(someColor); Android Layouts

Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved RelativeLayout The RelativeLayout is the default layout when you are using the Layout editor, but it can be difficult to use because it tries to relate different components that are added to the layout to other components. The following are some of the key attributes used with the RelativeLayout: layout_alignLeft layout_alignRight layout_alignTop layout_alignBottom These attributes cause an view component to be lined up with another view component either on its left, right, top or bottom. Android Layouts

Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved 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 or vice versa. The following attributes for this layout help with aligning: orientation layout_marginLeft layout_marginRight layout_marginTop layout_marginBottom The first of these attributes (orientation) determines if the LinearLayout is vertical or horizontal, but the other determine the left, right, top or bottom boundaries of any of the view components. Android Layouts

Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved TableLayout The TableLayout holds components in rows, and when used with the TableRow tag, it organizes the components into columns that line up with each other over different rows. If you place an view component inside a a TableLayout but outside of a TableRow tag, it will fill an entire row by itself without any columns being created. The following attributes are use dfor determining how much space goes in between the columns and rows: layout_margin layout_padding The first of these attributes controls the space outside the border between components, and the second one controls the space inside the border. Android Layouts

Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Other Important Attributes The following are other important attributes used in different types of layouts: id the id to use to load the component in Java code layout_widththe width of a view component layout_heightthe height of a view component textthe text that will appear within a view component backgroundthe background color of a view component textColorthe text color of a view component gravityhow to justify a view component: left, right, center textSizethe text size of a view component hintthe grayed out text hint inside an EditText component inputTypethe type of input allowed in an EditText component Android Layouts

Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Other Important Attributes Note: match_parent (aka fill_parent which has been depricated since API 8) and wrap_content are two common values given for the layout_width and layout_height attributes, and they have the following meaning: match_parent means that the view component should only be as big in that dimension as its parent (minus padding) wrap_content means that the view component should be just big enough to enclose its content (plus padding) Android Layouts