I\'m trying to define a fragment\'s layout in XML in the same way that I defined the layout of my view.
Is this possible? I tried several things, but none of them se
A Fragment works much like an activity, in that you need a Java class file to go with it. you cannot create a Fragment just by creating a fragment layout - you need a class for your fragment:
If you haven't already done so, read, re-read and digest everything on this page: https://developer.android.com/guide/components/fragments.html
There's a lot there, but Fragments are an essential part of Android apps now so it's required reading. The good news is that the basics of fragments is pretty simple.