With Android’s new constraint layouts (for Android Studio 2.3 and beyond), you can visually design apps by dragging and dropping GUI components right where you want them. Android Studio takes care of updating your app’s underlying XML—and you don’t need to hack any code.
This excerpt from Head First Android Development, Second Edition shows you hands-on how to use constraint layouts to build a simple app in no time. Get a copy of this report and discover how Android Studio’s design editor will save you from having to nest multiple layouts for complex UIs.
Why Head First? Based on the latest research in cognitive science and learning theory, Head First guides use a visually rich format to engage your mind, rather than a text-heavy approach to put you to sleep. Why waste your time struggling with new concepts? This multi-sensory learning experience is designed for the way your brain really works.
Table of contents
- Introducing the constraint layout
- Make sure your project includes the Constraint Layout Library
- Add the String resources to strings.xml
- Using the blueprint tool
- Position views using constraints
- Add a vertical constraint
- Changes to the blueprint are reflected in the XML
- How to center views
- Adjust a view’s position by updating its bias
- How to change a view’s size
- How to align views
- Let’s build a real layout
- First, add the top line of views
- The Infer Constraints feature guesses which constraints to add
- Add the next line to the blueprint...
- Finally, add a view for the message
- Test drive the app
- Want to learn more?
- About the Authors
- Title: Using Constraint Layouts in Android Studio
- Release date: August 2017
- Publisher(s): O'Reilly Media, Inc.
- ISBN: 9781491995594
You might also like
Head First Design Patterns, 2nd Edition
You know you don’t want to reinvent the wheel, so you look to design patterns—the lessons …
Learning React, 2nd Edition
If you want to learn how to build efficient React applications, this is your book. Ideal …
Fundamentals of Software Architecture
Salary surveys worldwide regularly place software architect in the top 10 best jobs, yet no real …
Head First Android Development, 2nd Edition
What will you learn from this book? If you have an idea for a killer Android …