Lesson 2: Learning and Understanding XML Layout
INTRODUCTION
In this lesson you will be introduced to the folder structure of the IDE Eclipse environment and understand the difference between Relative and Linear Layouts using XML with Java for Android applications. You will also be introduced to the process for changing, viewing and manipulating the text in various XML layouts.
Lesson Objectives
By the end of this lesson you will be able to:
Section #1: What Is XML?
- Identify the XML language and how you may use it to develop your app
- Determine the best way to complete design and development tasks while working within the structure of the IDE Eclipse environment
Section #2: What Can XML Layouts Do for Android?
- Examine XML Layouts in Android Development
Section #3: Differentiating between Relative and Linear Layouts in XML
- Discern the difference between Relative and Linear Layouts using XML with Android
Section #4: Video Demonstration
- Demonstrate how to edit and change XML code
- Use XML code to develop the desired layout for your app project
LEARNING SEQUENCE
Required Reading
|
Reading the following:
|
Resources
|
View and follow the steps to the following:
1. Eclipse (Integrated Development Environment)
2. Android Development Tools (ADT)
3. Video Tutorial: XML Video Tutorial: https://www.youtube.com/watch?v=91K25FRKScA
Java For Android 1: Introduction To The Eclipse/Android Development Environment
|
Assignments
|
Complete the following:
|
INSTRUCTION
Section #1: What Is XML?
In this section you will be introduced to the XML language and understand its power to support Android development.
In this reading you will be provided a definition of XML as a language and its main purpose with programming. There is a sample of the code included with descriptions for how the language is formatted. At the conclusion of reading, you will understand the benefits of using XML language and how to write it.
Section #2: What Can XML Layouts Do for Android?
In this section you will be introduced to XML layouts and the options for using them in the development of a layout for an Android application.
Read: Describe the XML for layouts used in Android Applications using Java.
Section #3: Differentiating between Relative and Linear Layouts in XML
In this video demonstration and tutorial, you will learn what the default XML code is, how to edit it, and how changing the code will impact your project. Please pause and review the video, as necessary, to complete tasks and meet these objectives:
- Recognize default code in XML
- Create your own code for the XML
- Understand what the new code does in the XML
Complete Section #4: The video will lead you through the following steps:
- You’ll than want to begin typing what is on screen, starting with the xml version and then continuing downwards
- The LinearLayout is the home of how your app will be set up. ‘android:orientation’ tells the device that the application will be vertical, meaning it locks the accelerometer, you can change this to being horizontal for future apps
- ‘android:layout_width’ and ‘android:layout_height’ both control where your app is positioned. ‘Fill_parent’ describes that the app will fill the whole screen, not leaving any space on the outside of the app
- ‘TextView’ is the code for displaying what the text in the app shows. ‘wrap_content’ describes that the text will expand to as big as the text will be, so it leaves space for the other parts of your app
- ‘android:textSize’ describes how big you want the text to be. For this you
- can type out px for pixel or dp for density independent pixels which is a ratio for the pixels to the screen size of the phone. Allowing the text to scale up or down depending on if you have a big size phone
- the ‘layout_gravity’ and ‘gravity’ refer to the position of the app. The ‘layout_gravity’ tells the text where it is located on screen, it defaults to being at the top of the app, and centering it will make it in the center of the top of the app. ‘gravity’ describes that the text will be centered in the middle of it’s home in the app, which is at the top of the screen.
- ‘id’ describes the identification of the ‘TextView’ in the Java, allowing it to be used and changed in the Java
- The coding in the button portion of the app is the same as the ‘TextView’, just changing the ‘Button:Text’ and the ‘Button:id’ to distinguish which is adding and which is subracting
- You have just successfully created the layout of your app. Congratulations.
SUMMARY
Additional Information Discussed In Class
JQuery Layouts
Responsive Web Apps
HTML5
Phonegap
API's
Questions for Posting on this blog:
Questions for Posting on this blog:
No comments:
Post a Comment