无法将列表视图转换为位图

Cannot Convert Listview to Bitmap

我正在尝试将布局转换为位图。布局包含 Textview 和 Listview。 Textview 在 Bitmap 中显示,但 Listview 在绘图缓存中显示但不显示(显示为空)。这是我的代码

Print.xml

   <LinearLayout
           android:id="@+id/screen_print1"
           android:layout_width="fill_parent"
           android:layout_height="wrap_content"
           android:orientation="vertical">

              <TextView
               android:id="@+id/tax_amnt"
               android:layout_width="360dp"
               android:layout_height="wrap_content"
               android:gravity="right"
               android:text="Tax  : 0" />    

             <ListView
               android:id="@+id/item_listview1"
               android:layout_width="fill_parent"
               android:layout_height="200dp"
               android:layout_gravity="center" />                  
     </LinearLayout>

Print.java

 LinearLayout screenshot = (LinearLayout) findViewById(R.id.screen_print1);
    ListView items_display=(ListView)findViewById(R.id.item_listview1);
    TextView tax_amount=(TextView)findViewById(R.id.tax_amnt);
    tax_amount.setText("00");

    ArrayList<HashMap<String, String>> bill_list1=OrderSummaryFragment.item_lists;
    itl1 = new Itemlist(getApplicationContext(), bill_list1);
    items_display.setAdapter(itl1);

    screenshot.setDrawingCacheEnabled(true);
    screenshot.buildDrawingCache();
    Bitmap bm = screenshot.getDrawingCache();
    screen_imageview.setImageBitmap(bm);

更新行

screenshot.setDrawingCacheEnabled(true);
screenshot.buildDrawingCache();

screenshot.setDrawingCacheEnabled(true);    
screenshot.measure(View.MeasureSpec.makeMeasureSpec(0,View.MeasureSpec.UNSPECIFIED),View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
screenshot.layout(0, 0, screenshot.getMeasuredWidth(), screenshot.getMeasuredHeight());
screenshot.buildDrawingCache(true);