Android UI Development with Jetpack Compose: Bring declarative and native UIs to life quickly and easily on Android using Jetpack Compose
- Length: 248 pages
- Edition: 1
- Language: English
- Publisher: Packt Publishing
- Publication Date: 2022-02-21
- ISBN-10: 1801812160
- ISBN-13: 9781801812160
- Sales Rank: #354744 (See Top 100 Books)
Get started with creating intuitive native user interfaces on Android platforms
Key Features
- Understand the difference between the imperative (Android View) and declarative (Jetpack Compose) approach
- Learn about the structure of a Compose app, built-in Compose UI elements, and core concepts such as state hoisting and composition over inheritance
- Write, test, and debug composable functions
Book Description
Jetpack Compose is Android’s new framework for building fast, beautiful, and reliable native user interfaces. It simplifies and significantly accelerates UI development on Android using the declarative approach. This book will help developers to get hands-on with Jetpack Compose and adopt a modern way of building Android applications. The book is not an introduction to Android development, but it will build on your knowledge of how Android apps are developed.
Complete with hands-on tutorials and projects, this easy-to-follow guide will get you up to speed with the fundamentals of Jetpack Compose such as state hoisting, unidirectional data flow, and composition over inheritance and help you build your own Android apps using Compose. You’ll also cover concepts such as testing, animation, and interoperability with the existing Android UI toolkit.
By the end of the book, you’ll be able to write your own Android apps using Jetpack Compose.
What you will learn
- Gain a solid understanding of the core concepts of Jetpack Compose
- Develop beautiful, neat, and immersive UI elements that are user friendly, reliable, and performant
- Build a complete app using Jetpack Compose
- Add Jetpack Compose to your existing Android applications
- Test and debug apps that use Jetpack Compose
- Find out how Jetpack Compose can be used on other platforms
Who this book is for
This book is for any mobile app developer looking to understand the fundamentals of the new Jetpack Compose framework and the benefits of native development. A solid understanding of Android app development, along with some knowledge of the Kotlin programming language, will be beneficial. Basic programming knowledge is necessary to grasp the concepts covered in this book effectively.
Android UI Development with Jetpack Compose Contributors About the author About the reviewers The Peer Reviewers Preface Who this book is for What this book covers To get the most out of this book Download the example code files Download the color images Conventions used Get in touch Share Your Thoughts Part 1:Fundamentals of Jetpack Compose Chapter 1: Building Your First Compose App Technical requirements Saying hello to composable functions Showing a welcome text Using rows, text fields, and buttons Showing a greeting message Using the preview Preview parameters Configuring previews Grouping previews Running a Compose app Deploying a composable function Using composable functions in activities Looking under the hood Pressing the play button Summary Further reading Chapter 2: Understanding the Declarative Paradigm Technical requirements Looking at the Android view system Inflating layout files Modifying the UI Moving from components to composable functions Component hierarchies Limitations of component hierarchies Composing UIs with functions Examining architectural aspects Reacting to clicks Sizing and positioning UI elements Summary Chapter 3: Exploring the Key Principles of Compose Technical requirements Looking closer at composable functions Building blocks of composable functions Emitting UI elements Returning values Composing and recomposing the UI Sharing state among composable functions Controlling size Displaying a composable hierarchy inside an Activity Modifying the behavior of composable functions Understanding how modifiers work Implementing custom modifiers Summary Part 2:Building User Interfaces Chapter 4: Laying Out UI Elements Technical requirements Using predefined layouts Combining basic building blocks Creating layouts based on constraints Understanding the single measure pass Defining measure policies Creating custom layouts Implementing a custom measure policy Summary Chapter 5: Managing the State of Your Composable Functions Technical requirements Understanding stateful and stateless composable functions Using state in a composable function Writing stateless composable functions Hoisting state and passing events Creating radio button groups Surviving configuration changes Using ViewModel Summary Chapter 6: Putting Pieces Together Technical requirements Styling a Compose app Defining colors, shapes, and text styles Using resource-based themes Integrating toolbars and menus Using Scaffold() to structure your screen Creating a top app bar Adding navigation Defining screens Using NavHostController and NavHost() Summary Chapter 7: Tips, Tricks, and Best Practices Technical requirements Persisting and retrieving state Injecting objects into a ViewModel Using the factory Keeping your composables responsive Communicating with ViewModel instances Handling long-running tasks Understanding side effects Invoking suspending functions Cleaning up with DisposableEffect() Summary Part 3:Advanced Topics Chapter 8: Working with Animations Technical requirements Using animation to visualize state changes Animating single value changes Animating multiple value changes Showing and hiding UI elements with animations Understanding AnimatedVisibility() Animating size changes Spicing up transitions through visual effects Crossfading composable functions Understanding animation specifications Summary Chapter 9: Exploring Interoperability APIs Technical requirements Showing Views in a Compose app Adding custom components to a Compose app Inflating View hierarchies with AndroidViewBinding() Sharing data between Views and composable functions Revisiting ViewModels Combining View Binding and ViewModels Embedding composables in View hierarchies Summary Chapter 10: Testing and Debugging Compose Apps Technical requirements Setting up and writing tests Implementing unit tests Testing composable functions Understanding semantics Working with semantics nodes Adding custom semantics properties Debugging Compose apps Using custom modifiers for logging and debugging Summary Further reading Chapter 11: Conclusion and Next Steps Technical requirements Exploring the future Showing exposed drop-down menus Using NavigationRail() Migrating to Material You Looking at some differences between Material 2 and Material 3 for Compose Moving beyond Android Setting up a sample project Summary Why subscribe? Other Books You May Enjoy Packt is searching for authors like you Share Your Thoughts
Donate to keep this site alive
How to download source code?
1. Go to: https://github.com/PacktPublishing
2. In the Find a repository… box, search the book title: Android UI Development with Jetpack Compose: Bring declarative and native UIs to life quickly and easily on Android using Jetpack Compose
, sometime you may not get the results, please search the main title.
3. Click the book title in the search results.
3. Click Code to download.
1. Disable the AdBlock plugin. Otherwise, you may not get any links.
2. Solve the CAPTCHA.
3. Click download link.
4. Lead to download server to download.