title: How can I define a fragment's layout from XML?
body: <p>I'm trying to define a fragment's layout in XML in the same way that I defined the layout of my view.</p>
  
  <p>Is this possible? I tried several things, but none of them seem to work.</p>
  
  <p>My activity layout looks as follows (main.xml):</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;ListView xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent" &gt;
    &lt;fragment
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:name="full.lommeregner.Lommeregnerrv2Activity"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:id="@+id/lommeregnerv2"&gt;
      &lt;/fragment&gt;   
  
  &lt;/ListView&gt;
  </code></pre>
  
  <p>Now, since I'm not a big fan of generating layouts through raw Java code, I tried defining my fragment as follows (fragment_lommeregner.xml):</p>
  
  <pre><code>  &lt;fragment
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:name="full.lommeregner.Lommeregnerrv2Activity"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:id="@+id/lommeregnerv2"&gt;
         &lt;!-- my content was located here (some textviews, buttons and so on). --&gt;
      &lt;/fragment&gt; 
  </code></pre>
  
  <p>Am I doing something wrong? How can I define the layout of a fragment through XML?</p>