title: Without using inflater and RecyclerView what's the best way to recreate my xml in code?
body: <p>I'd like to display this under a toggle button when the toggle button is pressed
  then disappear when the toggle button is pressed again, I've looked into expandable list views but it's seems over complicated for a few items that wont change visually. </p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="vertical" android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
      &lt;Button
          android:textSize="40dp"
          android:id="@+id/button"
          android:text="Dummy Job"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"/&gt;
  
     &lt;!-- &lt;android.support.v7.widget.RecyclerView
          android:id="@+id/jobStats"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"&gt;
  
  
      &lt;/android.support.v7.widget.RecyclerView&gt; --&gt;
  
      &lt;TextView
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:textSize="40dp"
          android:text="New Text"
          android:id="@+id/viewMachine" /&gt;
  
      &lt;TextView
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:textSize="40dp"
          android:text="New Text"
          android:id="@+id/viewItem"  /&gt;
  
      &lt;TextView
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:textSize="40dp"
          android:text="New Text"
          android:id="@+id/viewDate"  /&gt;
      &lt;LinearLayout
          android:id="@+id/testing"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:orientation="horizontal"
          android:weightSum="3"&gt;
          &lt;Button
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:textSize="40dp"
              android:text="Button"
              android:id="@+id/bJobOpen"
              android:layout_weight="1" /&gt;
  
          &lt;Button
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:textSize="40dp"
              android:text="Button"
              android:id="@+id/bJobEdit"
              android:layout_weight="1" /&gt;
  
          &lt;Button
              android:layout_width="245dp"
              android:layout_height="wrap_content"
              android:text="Button"
              android:id="@+id/bJobExport"
              android:textSize="40dp"
              android:layout_weight="1" /&gt;
      &lt;/LinearLayout&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Here is what i have for it's creation.</p>
  
  <pre><code> LinearLayout layout = (LinearLayout) findViewById(R.id.ReportsLayout);
                  LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, 1f);
                  //layout.setLayoutParams(lp);
                  //layout.setLayoutParams(lp);
                  //layout.setOrientation(LinearLayout.HORIZONTAL);
                  TextView viewMachine = new TextView(Reports.this);
                  TextView viewItem = new TextView(Reports.this);
                  TextView viewDate = new TextView(Reports.this);
                  LinearLayout horLayout = new LinearLayout(context);
                  Button enterJob = new Button(Reports.this);
                  Button editJob = new Button(Reports.this);
                  Button exportJob = new Button(Reports.this);
                  //enterJob.setLayoutParams(lp);
                  //editJob.setLayoutParams(lp);
                  //exportJob.setLayoutParams(lp);
                 if( button.isChecked()==(true)) {
                     layout.addView(viewMachine,lp);
                     layout.addView(viewItem,lp);
                     layout.addView(viewDate,lp);
  
                     layout.addView(enterJob,lp);
                     layout.addView(editJob, lp);
                     layout.addView(exportJob, lp);
                 }
                  else{
                      //layout.setVisibility(View.INVISIBLE);
                  }
              }
          };
      }
  </code></pre>
  
  <p>Problems are when i create this it looks like this</p>
  
  <p><a href="https://i.stack.imgur.com/TkKob.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TkKob.png" alt="enter image description here"></a></p>
  
  <p>setting the view to invis</p>