title: Android View View XML Programmatically
body: <p>I'm trying to debug a view that I'm creating programmatically. I'd like to be able to see what the exact XML is of the view after it's created. </p>
  
  <p>Really I'd like to be be able to do something like <code>Log.d(TAG,view.toString())</code></p>
  
  <p>And get an output like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout
      android:id="@+id/activity_main"
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:paddingBottom="@dimen/activity_vertical_margin"
      android:paddingLeft="@dimen/activity_horizontal_margin"
      android:paddingRight="@dimen/activity_horizontal_margin"
      android:paddingTop="@dimen/activity_vertical_margin"
      tools:context="sampleapp.example.com.tr221test.MainActivity"&gt;
  
      &lt;Button android:id="@+id/surveyButton"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Take Survey!"/&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>Is there anyway I can programmatically see what the xml is of a view?</p>