You have to remember that  To create an AVD(Android Virtual Device)  The Structure of Android Project  XML Layout  The advantage of XML Layout  Android.

Slides:



Advertisements
Similar presentations
Android User Interface
Advertisements

Programming with Android: Widgets and Events Luca Bedogni Marco Di Felice Dipartimento di Scienze dell’Informazione Università di Bologna.
Application Fundamentals. See: developer.android.com/guide/developing/building/index.html.
User Interface Android Applications. Activities An activity presents a visual user interface. Each activity is given a default window to draw in. The.
Layout and Control in UI The user interface (UI) is the graphical interface user can see and interact with your app comprising UI controls like textbox,
CS378 - Mobile Computing User Interface Basics MIKE!! LOOK HERE FOR intercepting the ListView items:
Android: Layouts David Meredith
Creating Android user interfaces using layouts 1Android user interfaces using layouts.
Introduction to Android Programming Content Basic environmental structure Building a simple app Debugging.
Android development the first app. Andoid vs iOS which is better? Short answer: neither Proponents on both sides For an iOS side, see this article on.
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.
CS5103 Software Engineering Lecture 08 Android Development II.
PROG Mobile Java Application Development PROG Mobile Java Application Development Developing Android Apps: Components & Layout.
Mobile Programming Lecture 2 Layouts, Widgets, Toasts, and Event Handling.
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.
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.
Chapter 2 The Android User Interface. Objectives  In this chapter, you learn to:  Develop a user interface using the TextView, ImageView, and Button.
INTRODUCTION TO ANDROID. Slide 2 Application Components An Android application is made of up one or more of the following components Activities We will.
Android Boot Camp for Developers Using Java, 3E
Programming with Android: Layouts, Widgets and Events Luca Bedogni Marco Di Felice Dipartimento di Scienze dell’Informazione Università di Bologna.
User Interfaces: Part 1 (View Groups and Layouts).
Application Development for mobile Devices
Presented By: Muhammad Tariq Software Engineer Android Training course.
Android Boot Camp for Developers Using Java, Comprehensive: A Guide to Creating Your First Android Apps Chapter 2: Simplify! The Android User Interface.
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.
ANDROID – DRAWING IMAGES – SIMPLE EXAMPLE IN INTERFACE AND EVENT HANDLING L. Grewe.
MOBILE COMPUTING D10K-7D02 MC04: Layouts Dr. Setiawan Hadi, M.Sc.CS. Program Studi S-1 Teknik Informatika FMIPA Universitas Padjadjaran.
HW#9 Clues CSCI 571 Fall, HW#9 Prototype
MOBILE COMPUTING D10K-7D02 MC05: Android UI Design Dr. Setiawan Hadi, M.Sc.CS. Program Studi S-1 Teknik Informatika FMIPA Universitas Padjadjaran.
Copyright© Jeffrey Jongko, Ateneo de Manila University Deconstructing HelloWorld.
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Android Boot Camp.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Android Drawing Units and The.
CS378 - Mobile Computing User Interface Basics. User Interface Elements View – Control – ViewGroup Layout Widget (Compound Control) Many pre built Views.
Building User Interfaces Basic Applications
Chapter 2 Building User Interfaces and Basic Applications.
Building User Interfaces and Basic Applications Chapter 2 1.
Android 基本 I/O. 基本 I/O 介面元件 在此節中主要介紹常見的 I/O 使用者介 面元件 – Button, TextView, 以及 EditText , 學習者可以學會: – Android 的視窗表單設計 res/layout/main.xml – Android SDK –
Http :// developer. android. com / guide / topics / fundamentals. html.
CS371m - Mobile Computing User Interface Basics. UI Programming with Widgets Widget is an element in a Graphical User Interface (GUI) – not to be confused.
ANDROID LAYOUTS AND WIDGETS. Slide 2 Introduction Parts of the Android screen Sizing widgets and fonts Layouts and their characteristics Buttons, checkboxes.
CMPE419 Mobile Application Development Asst.Prof.Dr.Ahmet Ünveren SPRING Computer Engineering Department Asst.Prof.Dr.Ahmet Ünveren
Chapter 2: Simplify! The Android User Interface
Open Handset Alliance.
Android N Amanquah.
Mobile Software Development for Android - I397
Android Widgets 1 7 August 2018
Mobile Application Development Chapter 4 [Android Navigation and Interface Design] IT448-Fall 2017 IT448- Fall2017.
HNDIT2417 Mobile Application Development
CS371m - Mobile Computing User Interface Basics.
CIS 470 Mobile App Development
CS371m - Mobile Computing User Interface Basics.
CS5103 Software Engineering
Mobile Computing With Android ACST 4550 Android Layouts
Building User Interfaces Basic Applications
BMI Android Application will take weight and height from the users to calculate Body Mass Index (BMI) with the information, whether user is underweight,
Note Q) How to format code in Enclipse? A) Ctrl + i
Android Developer Fundamentals V2
CIS 470 Mobile App Development
Korea Software HRD Center
Mobile Programmming Dr. Mohsin Ali Memon.
User Interface Screen Elements
User Interface Screen Elements
Android Sensor Programming
Presentation transcript:

You have to remember that  To create an AVD(Android Virtual Device)  The Structure of Android Project  XML Layout  The advantage of XML Layout  Android Emulator  To use Eclipse in Android Project Review

ISO English is represented by en French is represented by fr German is represented by de (from the endonym Deutsch) Italian is represented by it Korea is represented by ko Japanese is represented by ja (even though its endonym is Nihongo) Portuguese is represented by pt Spanish is represented by es (from the endonym español) Swedish is represented by sv (from the endonym Svenska) Locale List

Course Objects  Understand the views and layout, layout, utilizing management Find out about the different techniques. Contents  View, ViewGroup  TextView  ImageView  Button  EditText  Linear Layout Contents

The layer of Views  Android applications that make up the main unit's screen activity can not be seen directly on the screen, in the view the user -facing activity is the reality.  Sign in multiple views of a configuration of activities and these activities are the things one application.  In view of the layout to place the activity refers to the technique.  View Widget : The user interface configuration looks directly, and often referred to as a control. View Groups : View acts as a container, this class is called the layout of classes.  View the group, yet there are classes that may be used as the widget. If you want to know the details of a particular widget should study Starting with its super class.  The subclass inherits all the attributes of the super class. 1. View

Widget hierarchy  View a Java class is a kind of root is derived from Object.  View all classes that derive directly from the right is a widget that can draw their own capabilities. 1. View Object View TextView ImageView Button EditText CompoundButton CheckBox RadioButton AnalogClock AutoCompleteTextView ToggleButton Chronometer DigitalClock ImageButton SurfaceViewGLSurfaceView VideoView ProgressBarAbsSeekBarRatingBar SeekBar EditText

View Groups hierarchy  ViewGroup is derived from the subclasses of View.  With other views, including the child and the child has the ability to sort. 1. View Object View ViewGroup FrameLayout AbsoluteLayout AdapterView LinearLayout RelativeLayout AbsListView RadioGroup, ZoomControls TableLayout, TableRow ViewFlipper ViewSwitcher AbsSpinner ListView GridView WebView ScrollView, HorizontalScrollView TabHost, TimePicker, DatePicker ViewAnimator ImageSwitcher TextSwitcher TabWidget Spinner Gallery

The example that is related TextView Practice(1/6) TextView 1 TextView 2 TextView 3

Practice(2/6)

Practice(3/6) singleLine/res/values/string.xml Hello World, SingleLineActivity! SingleLine Hello Lovely Panama

Practice(4/6) singleLine/res/layout/main.xml <LinearLayout xmlns:android=" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" />

Practice(5/6) singleLine/res/layout/main.xml <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:textColor="#ff0000" android:textSize="20pt" android:textStyle="italic" /> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:textSize="20pt" android:background="#0000ff" />

Practice(6/6) singleLine/res/layout/main.xml <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Good Morning" android:textColor="#8000ff00" android:textSize="5mm" android:typeface="serif" />

Attribute of View  id Defines a view called the name, and code references a view from an XML document using the id, so intuitive, a good idea to name. Form : id of the resource (R.java) means that in the definition or reference, and shall be unconditional. - + : ID means that the new definition, and can see the poem is omitted. - id : Reserved - / : But after writing your name, ID, so the command must comply with the rules for its own name, and the view will not overlap each other. ex) : id is given which is called name in text view. If you specify an XML document ID to R.java this name is defined as an integer constant. When referenced in the code view findViewById method invocation, argument passing reference to the view id. It is compulsory to all views that do not need to specify the id, the code does not require reference to the widget id is usually omitted. 1. View

Attribute of View  layout_width, layout_height Specify the width and height of the view, and horizontal and vertical size for each direction can be specified. As one of the following three attribute has a value. - fill_parent : It fills the parent of a given size. - wrap_content : Fills only the size of the contents. - Integer size : Adjusted to the size specified. ex) The caption which is contained “Start” 1. View Unit : px, in, mm, pt, dp (or dip), sp (or sip)

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. 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 density and user's preference. Unit

Attribute of View  Background View, which specifies the background color and images can be specified as many as. When designating the four types of color is applied and to specify the background color as well be applied to all properties. - #RGB - #ARGB - #RRGGBB - #AARRGGBB ex) #ff0000 (#f00) : Red, #0000ff : Blue  Padding Specify the interval between the contents view. (I.E. padding ) Specifies the padding property values ​​ for the four directions can be adjusted margins. Value of attribute : paddingLeft, paddingTop, paddingRight, paddingBottom 1. View

Attribute of View  Visibility Specifies whether the view displays, and down to the attribute has a value of one of the three. - visible : A Status that can be seen. - invisible : Hidden state, occupies seat. - gone : Hidden state, is taking place.  clickable, longClickable Want to receive mouse click events, Long Click to specify whether the event should be. - click : With your fingers while holding the view - longClick : I wait for my status as a view of the finger holding down the The authenticity of one of them, so no true or false to specify the value.  Focusable Specifies whether keyboard focus should be. The default value is set to false, and if necessary to change the property to true. Editor, like a button or a derived class of the user input is required, has been designated to be true by default. 1. View

TextView  String that receives the output and input widgets  Hidden and the input function is activated in a subclass EditText.  text Output to a text view, the most important attribute string. Literal and as a resource to the assignment. 1. View FormDescription “String”Wrap the string with double quotes is just an by reference to the resource. ?[Package:][type:]nameShould be attributed to the theme.  textColor Specifies the color of the string, and the default is an opaque gray. #RRGGBB or #AARRGGBB Format specifies the intensity of each color component.

1. View TextView  textSize Specify the font size of text, and when you specify a number followed by a mistake of type sp, dp, px, in, mm, and is specified as a unit.  textStyle Specify the properties of the font. normal, bold, italic or write to one of the '|', surrounded by more than one can specify a constant value. ex: “bold|italic”, “normal|italic”  typeFace Specifies the font's appearance, and, normal, sans, serif, monospace, select one of the possible. In a mobile environment, there are restrictions on the number of embedded fonts.  width, height The size of the text view is the width and height are specified as a value and units. Text view alone, if there is a little child in the layout as most of these properties because there are rarely used.

1. View(ImageView) ImageView  Desktop icon or bitmap output, resources, files and content, as well as a provider or can be displayed as an image on the web.  src Specifies the output image is the most important properties. Resources, mainly the image has a to the output image format is used.  maxHeight, maxWidth Specifies the maximum size of output image  adjustViewbounds To keep the aspect ratio of the image will be adjusted appropriately by the image view, you specify the size, and attribute values ​​ either true or false is used.  Other cropToPadding, tint, scaleType

Practice(1/4) ImageView  ImageView is supporting to jpg, png, gif images  Since SDK 1.6 by the density and the presence of three folders, each folder for each image resolution put the operating system determines which image to use.

Practice(2/4) ImageView/layout/main.xml <LinearLayout xmlns:android=" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" /> Project name: ImageView Build Target: Android Package name: exam.imageview

Practice(3/4) ImageView/layout/main.xml <ImageView android:layout_width="150dp" android:layout_height="150dp" /> <ImageView android:layout_width="fill_parent" android:layout_height="wrap_content" android:maxHeight="70px" android:maxWidth="120px" android:adjustViewBounds="true" android:tint="#4000ff00" />

Practice(4/4) ImageView/layout/main.xml <ImageView android:layout_width="150dp" android:layout_height="150dp" />

1. View(Button, EditText) Button, Edit  View, TextView is a subclass of the one that does not have its own properties.  Button  EditText : Received from the user typing the command Toast EditText Button

Practice(1/4) ButtonEdit/layout/main.xml <LinearLayout xmlns:android=" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" />

Practice(2/4) ButtonEdit/layout/main.xml <EditText android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Input here" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="OK" />

Practice(3/4) ButtonEdit/src/ButtonEditActivity.xml package exam.buttonedit; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class ButtonEditActivity extends Activity { /** Called when the activity is first created. public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main);

Practice(4/4) ButtonEdit/src/ButtonEditActivity.xml Button btn = (Button)findViewById(R.id.btn); btn.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { EditText edit = (EditText)findViewById(R.id.edit); String str = edit.getText().toString(); Toast.makeText(ButtonEditActivity.this, str, Toast.LENGTH_SHORT).show(); } }); }

Preview Tomorrow, We are going to study  Linear Layout  Absolute Layout  Frame Layout  Table Layout  Nested Layout  Layout Management  The Application that is sending .

2. Linear Layout LinearLayout  Child view horizontally and vertically, side-by-side with the layout, the most simple and intuitive, and a high frequency of use.  Orientation Property that determines the orientation of the view (Default is horizontal) vertical : Rothschild arranged vertically from top to bottom horizontal : Array of children, from left to right horizontally Button1 Button2 Button3 [ vertical ] Button1Button2Button3 [ horizontal ]

2. Linear Layout LinearLayout Layout/Horizontal <LinearLayout xmlns:android= android:orientation=“horizontal” android:layout_width=“fill_parent” android:layout_height=“fill_parent” > Layout/Horizontal3 <TextView android:layout_width=“wrap_content” android:layout_height=“wrap_content” android:textColor=“#ff0000” android:textSize=“20pt” android:textStyle=“italic”/> Layout/Horizontal2 <TextView android:orientation=“horizontal” android:layout_width=“fill_parent” android:layout_height=“wrap_content” android:textColor=“#ff0000” android:textSize=“20pt” android:textStyle=“italic”/> [ Horizontal ] [ Horizontal2 ] [ Horizontal3 ]