Building User Interfaces Basic Applications

Slides:



Advertisements
Similar presentations
Android UserInterfaces Nasrullah Niazi. overView All user interface elements in an Android app are built using View and ViewGroup objects. A View is an.
Advertisements

Android User Interface
Unlocking Android Chapter 4.  Understanding activities and views  Exploring the Activity lifecycle  Working with resources  Defining the AndroidManifest.xml.
 User Interface - Raeha Sandalwala.  Introduction to UI  Layouts  UI Controls  Menus and ‘Toasts’  Notifications  Other interesting UIs ◦ ListView.
User Interface Classes.  Design Principles  Views & Layouts  Event Handling  Menus  Dialogs.
Filip Debelić What is it? Android is a mobile operating system (OS) based on the Linux kernel and currently developed by Google Android,
User Interface Android Applications. Activities An activity presents a visual user interface. Each activity is given a default window to draw in. The.
By: Jeremy Smith.  Introduction  Droid Draw  Add XML file  Layouts  LinearLayout  RelativeLayout  Objects  Notifications  Toast  Status Bar.
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.
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.
Favorite Twitter® Searches App Android How to Program © by Pearson Education, Inc. All Rights Reserved.
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.
Java Software Solutions Lewis and Loftus Chapter 10 1 Copyright 1997 by John Lewis and William Loftus. All rights reserved. Graphical User Interfaces --
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.
UI Resources Layout Resources String Resources Image Resources.
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.
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.
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.
Building User Interfaces Basic Applications
CS378 - Mobile Computing More UI. UI Review Containers – more formally ViewGroups – store widgets and other containers – examples: LinearLayout, RelativeLayout,
Chapter 2 Building User Interfaces and Basic Applications.
CHAPTER 9 File Storage Shared Preferences SQLite.
Building User Interfaces and Basic Applications Chapter 2 1.
CHAPTER 4 Fragments ActionBar Menus. Explore how to build applications that use an ActionBar and Fragments Understand the Fragment lifecycle Learn to.
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 5: Investigate! Lists, Arrays, and Web Browsers.
UI Redux, Navigation Patterns, Tabbed Views, Pagers, Drawers
Chapter 2: Simplify! The Android User Interface
Open Handset Alliance.
Activities and Intents
Creation of an Android App By Keith Lynn
Mobile Application Development Chapter 4 [Android Navigation and Interface Design] IT448-Fall 2017 IT448- Fall2017.
Politeknik Elektronika Negeri Surabaya
Chap 7. Building Java Graphical User Interfaces
Android SDK & App Development
CS371m - Mobile Computing User Interface Basics.
Graphical User Interfaces -- Introduction
CIS 470 Mobile App Development
CS371m - Mobile Computing User Interface Basics.
CS323 Android Getting Started
CS5103 Software Engineering
Android Topics Custom ArrayAdapters
Android Developer Fundamentals V2
CIS 470 Mobile App Development
Korea Software HRD Center
Introduction to Android
Mobile Programmming Dr. Mohsin Ali Memon.
User Interface Screen Elements
User Interface Screen Elements
CS 240 – Advanced Programming Concepts
Android Sensor Programming
Presentation transcript:

Building User Interfaces Basic Applications Chapter 2 Building User Interfaces Basic Applications Chapter objectives: Become familiar with Android user interface Learn about text input widgets Understand Views, widgets, and how the R.java class is constructed Implement applications that require various User Interface Controls Adaptive Design Concepts Organize screen content using ViewGroup containers Use adapters to create sophisticated user interfaces 12/25/2018

2.1 Android User Interface User interface is a collection of visual objects arranged on the screen that the user can see and interact with can be created in java code or created in an external XML layout file 12/25/2018

GUI in Android app is made of a hierarchy of View and ViewGroup objects View objects are usually UI widgets (buttons, text fields, etc.) ViewGroup objects are invisible view containers that defines how the child views are laid out XML is used to describe the hierarchy of View and ViewGroup A layout resource file is referred to as layout. 12/25/2018

Typically, an activity (screen represent that activity) uses it onCreate() method to associate it with external layout file. 12/25/2018

2.2 Layouts Visual interfaces can be defined by one or more layout files The term Layout denotes the visual architecture of the application Typically, a single XML layout file for each Activity. Layout XML files often contains other layout XML files to allow reuse of screen elements for multiple locations 12/25/2018

All layout files are configured in a hierarchical tree: There are six standard root layouts: RelativeLayout LinearLayout TableLayout RowLayout GridLayout FrameLayout 12/25/2018

12/25/2018

A RelativeLayout is used for screen designs that require control elements to be positioned in relation to one another A LinearLayout is used for simple arrangments that require elements to be displayed along either a horizontal or vertical line A TableLayout is used to arrange elements into tabular rows and columns 12/25/2018

12/25/2018

12/25/2018

12/25/2018

12/25/2018

2.3 The View Class Android user interface is built around an object called a View A View describes every interactive visual control object that appears on an application screen Every control object in an Android user interface is a subclass of the Android View class 12/25/2018

The user interface for your application can be built in two ways: Constructing it as a layout using XML code Building the entire layout, or pieces of the layout, programmatically at runtime 12/25/2018

2.4 Text Input and Output TextView and EditText are the two Android text field classes, both derived from the View super class TextView is used primarily for text output EditText allows text input and editing by the user 12/25/2018

For example, InputType properties can be set to: textCapCharactors Attributes must be applied to an EditText object to customize type of data for input. For example, InputType properties can be set to: textCapCharactors textAutoCorrect textAutoComplete TextNoSuggestions 12/25/2018

12/25/2018

2.5 Soft Keyboards On-screen keyboard is called a soft keyboard 12/25/2018

12/25/2018

12/25/2018

12/25/2018

12/25/2018

imeOptions actionSend actionDone actonGo actionNext actionPrevious 12/25/2018

12/25/2018

2.6 Android’s Form Widgets for UI Android provides a wide set of input controls (widgets), to be used in an app’s user interface Widgets are subclasses of the View base class Each widget has a built-in set of properties that can be used to customize its appearance Each widget has a built-in set of methods that can be used to access values Each widget has a built-in set of interfaces that can be used to handle events 12/25/2018

12/25/2018

2.6.1 RadioButton and CheckBox Radio buttons work in a group They are used when only a single item from a collection of items must be selected If a radio button is already selected, it will be de-selected when another radio button in the collection is selected. CheckBox widget is a type of two-state button 12/25/2018

12/25/2018

2.6.2 ToggleButton A toggle button allows the user to change a setting between two states, such as on or off. 12/25/2018

2.6.3 Switch A Switch is a two-state toggle switch widget that can select between two options: off/on The user can drag the "thumb" back and forth to choose the selected option, or simply tap to toggle as if it were a checkbox 12/25/2018

12/25/2018

2.6.4 ProgressBar A ProgressBar is a visual indicator of progress in a given operation A ProgressBar control can be displayed to the user representing how far an operation has progressed 12/25/2018

2.6.5 SeekBar A SeekBar is an extension of ProgressBar that adds a draggable thumb 2.6.6 RatingBar RatingBar is an extension of SeekBar and ProgressBar that shows a rating in starts. 12/25/2018

2.6.7 Spinner Spinners provide a quick way to select one value from a set of values 12/25/2018

String Array Resource <?xml version="1.0" encoding="utf-8"?> <resources> <string-array name="planets_array"> <item>Mercury</item> <item>Venus</item> <item>Earth</item> <item>Mars</item> </string-array> </resources> <Spinner android:id="@+id/spinner" android:layout_width="wrap_content" android:entries="@array/planets_arrays" android:prompt="@string/planets_prompt" android:layout_height="wrap_content" /> 12/25/2018

ArrayList<String> planets = new ArrayList<String>(); planets.add("Mercury"); planets.add("Venus"); planets.add("Earth"); planets.add("Mars"); ArrayAdapter adapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, planets); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); 12/25/2018

2.7 Unique ID of a View Object & the R Class id is a View attribute When an app is compiled, all View objects are assigned a unique integer that identifies them R.java is an auto-generated file to manage ids Once a View can be uniquely identified, it can be referenced in Java source code 12/25/2018

2.8 The ViewGroup A ViewGroup is a container of View objects All ViewGroup objects are also View objects A ViewGroup is a special type of View that is designed to hold groups of Views Each ViewGroup is an invisible container that organizes child Views 12/25/2018

12/25/2018

2.8.1 RadioGroup A RadioGroup object is a ViewGroup container As a ViewGroup, the RadioGroup is used to group together a related set of RadioButtons 12/25/2018

12/25/2018

2.9 Adaptive Design Concepts – Screens and Orientations Many variations in screen sizes available Adaptive design is important because it supports flexibility when designing an app that can work on multiple devices Adaptive design refers to the adaptation of a layout design that fits an individual screen size and/or orientation 12/25/2018

Developers should expect their applications to be installed on devices with screens that range in both size and density Apps should revise layouts to optimize the user experience in each orientation: landscape or portrait   12/25/2018

12/25/2018

2.10 TableLayout and TableRow TableLayouts are often used for organizing data content into tabular form Tables can be added to a layout file using the Graphical Layout Editor or programmatically using Java The number of columns automatically matches the number of columns in the row with the most columns The width of each column is defined as the width of the widest content in the column 12/25/2018

12/25/2018

2.11 Container Views Container Views are ViewGroups Android categorizes this group of Views as “containers” because their sole function is to act as containers for other views Any object that provides access to container values is referred to as a Container 12/25/2018

12/25/2018

2.11.1 ListView, GridView, ExpandableListView The ListView, GridView, and ExpandableListView are all AdapterViews. This means they are populated with Views that are identified by an Adapter.   A ListView object displays items in a vertically scrolling list GridView displays contain items in a two-dimensional scrolling grid. A ExpandableListView is an extension of a ListView. This type of container displays items in a vertically scrolling list that supports two levels 12/25/2018

2.11.2 ScrollView & HorizontalScrollView The ScrollView and the HorizontalScrollView are containers specifically designed for scrolling Both these containers are extensions of the FrameLayout Once a View has been placed in either of these containers, the view can be made scrollable 12/25/2018

2.11.3 SearchView The SearchView is typically added to the menu and provides an easy way to incorporate a standard search into the header of any activity   The Android system controls all search events  A SearchView object can be placed anywhere in your layout and will behave like a standard EditText View 12/25/2018

2.11.4 VideoView A VideoView is an extension of a SurfaceView It is used to display a video file This means that it can load images from various sources (such as resources or content providers), and provides various display options such as scaling and tinting 12/25/2018

2.12 Using an Adapter Adapter provides a common interface to the data model behind an AdapterView, such as a ListView object An Adapter is responsible for accessing the data to be supplied to a container widget and converting the individual elements of data into a specific format The Adapter behaves as a middleman between the data source and the AdapterView layout 12/25/2018

12/25/2018