title: Save Layout as Bitmap
body: <p>I want to save my Linearlayout as an bmp.</p>
  
  <pre><code>&lt;LinearLayout
          android:orientation="horizontal"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:id="@+id/linearLayout_QrCode" &gt;
  
          &lt;Space
              android:layout_width="15dp"
              android:layout_height="match_parent"
              android:layout_gravity="center_vertical" /&gt;
  
          &lt;LinearLayout
              android:orientation="vertical"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content" &gt;
  
              &lt;Space
                  android:layout_width="match_parent"
                  android:layout_height="15dp" /&gt;
  
              &lt;ImageView
                  android:layout_width="185dp"
                  android:layout_height="185dp"
                  android:id="@+id/imageView_qrcode" /&gt;
  
              &lt;Space
                  android:layout_width="match_parent"
                  android:layout_height="15dp" /&gt;
  
          &lt;/LinearLayout&gt;
  
          &lt;RelativeLayout
              android:layout_width="417dp"
              android:layout_height="match_parent" &gt;
  
              &lt;Space
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_centerVertical="true"
                  android:layout_alignParentStart="true"
                  android:id="@+id/space2" /&gt;
  
              &lt;TextView
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:textAppearance="?android:attr/textAppearanceLarge"
                  android:id="@+id/textView_QrSticker_label"
                  android:layout_alignParentStart="true"
                  android:layout_above="@+id/space2"
                  android:textStyle="bold"
                  android:textSize="40sp" /&gt;
  
              &lt;TextView
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:textAppearance="?android:attr/textAppearanceLarge"
                  android:id="@+id/textView_QrSticker_serial"
                  android:layout_below="@+id/space2"
                  android:layout_alignParentStart="true"
                  android:textSize="30sp" /&gt;
          &lt;/RelativeLayout&gt;
  
      &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Therefore I use the following code to perform this:</p>
  
  <pre><code>        public Bitmap viewToBitmap(View view) {
              Bitmap bitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888);
              Canvas canvas = new Canvas(bitmap);
              view.draw(canvas);
              return bitmap;
          }
  </code></pre>
  
  <p>But If I run this code my bitmap only contains the <code>ImageView</code> (ImageView_qrcode). I checked it. If I inflate the Linearview the <code>TextViews</code> are shown correctly but the output bmp only contains the <code>ImageView</code> does somebody know why?</p>