0%

Book Description

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

  1. 1.  
    1. Introducing the constraint layout
      1. You design constraint layouts VISUALLY
      2. Create a new project
    2. Make sure your project includes the Constraint Layout Library
    3. Add the String resources to strings.xml
      1. Change activity_main.xml to use a constraint layout
    4. Using the blueprint tool
    5. Position views using constraints
      1. We’ll add a horizontal constraint to the button
    6. Add a vertical constraint
      1. Changing the view’s margins
    7. Changes to the blueprint are reflected in the XML
    8. How to center views
    9. Adjust a view’s position by updating its bias
    10. How to change a view’s size
      1. 1. Make the view a fixed size
      2. 2. Make it just big enough
      3. 3. Match the view’s constraints
      4. 4. Specify the width:height ratio
    11. How to align views
    12. Let’s build a real layout
    13. First, add the top line of views
      1. Get the design editor to infer the constraints
    14. The Infer Constraints feature guesses which constraints to add
    15. Add the next line to the blueprint...
      1. ... and then add the button
    16. Finally, add a view for the message
    17. Test drive the app
    18. Want to learn more?
  2. About the Authors
  3. Copyright
3.131.110.169