Build a Fragment (Pick Players)

Throughout this book, we’re going to be using <ConstraintLayout> view groups as the main containers for most of our screens. We could handle things a few ways, but <ConstrainLayout> is a great way to get things right where you want them on each screen while still allowing for the flexibilty needed for multiple device types. In fragment_pick_players.xml, we can replace the entire existing <FrameLayout> tag with this new <ConstraintLayout>. The XML will then look like this:

 <?xml version="1.0" encoding="utf-8"?>
 <androidx.constraintlayout.widget.ConstraintLayout
  xmlns:android=​"http://schemas.android.com/apk/res/android"
  xmlns:app=​"http://schemas.android.com/apk/res-auto"
  xmlns:tools=​"http://schemas.android.com/tools" ...

Get Kotlin and Android Development featuring Jetpack now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.