O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Hands-On Android UI Development

Book Description

Master the art of creating impressive and reactive UIs for mobile applications on the latest version of Android Oreo.

About This Book

  • A comprehensive guide to designing and developing highly interactive user interfaces for your app.
  • Design responsive and agile applications targeting multiple Android devices (up to Android Oreo) using Android Studio 3.0
  • Write reactive user interfaces with minimal effort by leveraging the latest Android technologies, such as Architecture components and the Lifecycle API
  • Avoid common design problems and pitfalls with the help of shared UI design patterns and best practices.

Who This Book Is For

This book is for novice Android and Java developers who have a basic knowledge of Android development and want to start developing stunning user interfaces.

What You Will Learn

  • Create effective and efficient user interfaces that allow users to carry out tasks smoothly
  • Understand the fundamentals of Android UI design, and take a look at the basic layouts, Inputs, and controls
  • Learn about various UI components provided by Android, which include structured layout objects and UI controls that allow you to build the graphical user interface for your app
  • Explore various styles and themes that allow you to customize the look and feel of your app
  • Leverage the animation and graphics APIs to improve user experience and draw custom 2D graphics

In Detail

A great user interface (UI) can spell the difference between success and failure for any new application. This book will show you not just how to code great UIs, but how to design them as well. It will take novice Android developers on a journey, showing them how to leverage the Android platform to produce stunning Android applications.

Begin with the basics of creating Android applications and then move on to topics such as screen and layout design. Next, learn about techniques that will help improve performance for your application. Also, explore how to create reactive applications that are fast, animated, and guide the user toward their goals with minimal distraction.

Understand Android architecture components and learn how to build your application to automatically respond to changes made by the user. Great platforms are not always enough, so this book also focuses on creating custom components, layout managers, and 2D graphics. Also, explore many tips and best practices to ease your UI development process.

By the end, you'll be able to design and build not only amazing UIs, but also systems that provide the best possible user experience.

Style and approach

This book takes an easy tutorial approach to help you learn how to create consistent and efficient user interfaces for your apps. The book first takes you through the basics of user interfaces such as basic layouts, inputs, and controls, and also covers animations and graphics. By the end of the book, you will have learned best practices and will be able to develop inspired interfaces that look good and also work subtly in the background.

Table of Contents

  1. Preface
    1. What this book covers
    2. What you need for this book
    3. Who this book is for
    4. Conventions
    5. Reader feedback
    6. Customer support
      1. Downloading the example code
      2. Errata
      3. Piracy
      4. Questions
  2. Creating Android Layouts
    1. Material Design
    2. Android Studio
    3. Android application structure
    4. Creating SimpleLayout
    5. Discovering the layout editor
    6. Organizing project files
    7. Summary
  3. Designing Form Screens
    1. Exploring form screens
    2. Designing a layout
    3. Creating a form layout
      1. Creating the description box
      2. Adding the amount and date inputs
      3. Creating the category chooser
        1. Making icons change with state
        2. Creating the category picker layout
      4. Adding the attachment preview
    4. Try it yourself
    5. Test your knowledge
    6. Summary
  4. Taking Actions
    1. Understanding Android event requirements
    2. Listening for some events
    3. Wiring the CaptureClaimActivity events
    4. Handling events from other activities
    5. Making events quick
    6. Multiple event listeners
    7. Test your knowledge
    8. Summary
  5. Composing User Interfaces
    1. Designing a modular layout
    2. Creating the DatePickerLayout
    3. Creating the data model
      1. Creating the Attachment class
      2. Creating the Category enum
      3. Creating the ClaimItem class
    4. Wrapping up the category picker
    5. Creating the Attachment Pager
      1. Creating the Attachment preview widget
      2. Creating the Attachment Pager Adapter
      3. Creating the Create Attachment Command
      4. Creating the Attachment Pager Fragment
      5. Capturing the ClaimItem data
    6. Try it yourself
    7. Test your knowledge
    8. Summary
  6. Binding Data to Widgets
    1. Exploring data models and widgets
    2. The Observer pattern
    3. Enabling data binding
    4. Data binding a layout file
      1. Creating an Observable model
      2. Establishing the AllowanceOverviewFragment
      3. Creating the AllowanceOverview layout
      4. Updating the SpendingStats class
    5. Data binding and fragments
    6. Test your knowledge
    7. Summary
  7. Storing and Retrieving Data
    1. Data storage in Android
    2. Using the SQLite database
    3. Introducing Room
      1. Adding Room to the project
    4. Creating an Entity model
    5. Creating the Data Access Layer
      1. The LiveData class
      2. Implementing Data Access Objects in Room
    6. Creating a database
    7. Accessing your Room database
    8. Test your knowledge
    9. Summary
  8. Creating Overview Screens
    1. Designing an Overview screen
    2. Elements of an Overview screen
    3. Creating layouts for ViewHolders
      1. Creating a simple ViewHolder class
    4. Creating a ViewHolder with data binding
    5. Creating a RecyclerView adapter
      1. Data binding an adapter
    6. Creating the Overview activity
      1. Creating new ClaimItems with a Fragment
      2. Allowance overview with a Room database
    7. Test your knowledge
    8. Summary
  9. Designing Material Layouts
    1. Looking at material structure
    2. Introducing CoordinatorLayout
    3. Coordinating the Overview Screen
    4. Swiping to delete
    5. Elevating widgets
    6. Building layouts using grids
    7. Stack view
    8. Test your knowledge
    9. Summary
  10. Navigating Effectively
    1. Planning navigation
    2. Tabbed navigation
      1. Bottom tabs navigation
    3. Navigation menus
    4. Navigating using Fragments
    5. Test your knowledge
    6. Summary
  11. Making Overviews Even Better
    1. Multiple view types
    2. Introducing dividers
    3. Updating by Delta Events
    4. Test your knowledge
    5. Summary
  12. Polishing Your Design
    1. Choosing colors and theming
      1. Producing an application palette
      2. Generating palettes dynamically
    2. Adding animations
      1. Creating custom animations
      2. Activating more animations
    3. Creating custom styles
    4. Test your knowledge
    5. Summary
  13. Customizing Widgets and Layouts
    1. Creating custom view implementations
      1. Integrating the SpendingGraphView
    2. Creating a layout implementation
    3. Creating animated views
    4. Test your knowledge
    5. Apply your knowledge
    6. Summary
  14. Activity Lifecycle
  15. Test Your Knowledge Answers
    1. Chapter 2 - Designing Form Screens
    2. Chapter 3 - Taking Actions
    3. Chapter 4 - Composing User Interface
    4. Chapter 5 - Binding Data to Widgets
    5. Chapter 6 - Storing and Retrieving Data
    6. Chapter 7 - Creating Overview Screens
    7. Chapter 8 - Designing Material Layouts
    8. Chapter 9 - Navigating Effectively
    9. Chapter 10 - Making Overviews Even Better
    10. Chapter 11 - Polishing Your Design
    11. Chapter 12 - Customizing Widgets and Layouts