Skip to Content
Native Mobile Development
book

Native Mobile Development

by Shaun Lewis, Mike Dunn
November 2019
Intermediate to advanced
394 pages
9h 44m
English
O'Reilly Media, Inc.
Content preview from Native Mobile Development

Chapter 2. Views

In most graphical UI (GUI) frameworks, visual elements on the screen are represented by objects generally called “views” in architectural parlance. In web applications, a view might be an HTML element, but in some web frameworks a view is an entire web page, or a fragment of a page. Java Swing, and a number of other frameworks, use “components” to represent the view portion of the application.

In native mobile development, a view is exactly that—an instance of a View (Android) or UIView (iOS) subclass.

Views can be atomic elements and represent a single visual element on a screen, like a piece of text or an image, but might also be a more complicated hierarchy of views for layout, like a list of rows, or even more sophisticated, like a calendar widget with significant, sophisticated behavior built into the view itself.

Views are also necessary to receive user input. Buttons, switches and toggles, checkboxes, select boxes, and text inputs are all examples of views that enable your user to interact with your app.

Tasks

In this chapter, you’ll learn to:

  1. Create a new view.

  2. Nest views.

  3. Update a view’s state.

Android

In Android, the base class is View, and it is not abstract—you can instantiate a simple View where needed, although it may not be that common. One example is that sometimes simple View instances are used as lines or shapes, by simply providing dimensions and a background color, or as hit areas without visual representation. Some common examples ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Pro iPhone Development with SwiftUI: Design and Manage Top Quality Apps

Pro iPhone Development with SwiftUI: Design and Manage Top Quality Apps

Wallace Wang
Ionic in Action

Ionic in Action

Jeremy Wilken
What Employees Want Most in Uncertain Times

What Employees Want Most in Uncertain Times

Kristine W. Powers, Jessica B.B. Diaz

Publisher Resources

ISBN: 9781492052869Errata PageSupplemental Content