我正在給一個ViewGroup充氣以導出爲PDF文檔。從xml文件中填充它後,我用圖像和文本填充它。現在,當我嘗試在PDF頁面的畫布中繪製此ViewGroup時,VieGroup的高度爲零。畫布是空的。等待視圖完全更新:如何?
這是代碼:
View pdfRowLayout = ltInflater.inflate(R.layout.pdf_export_row_layout,
(ViewGroup) parent, false);
TextView action = (TextView) pdfRowLayout.findViewById(R.id.pdf_action_field);
action.setText(host.getDataProvider().getChildItem(curGroupPosition, 1).getText());
ImageView avatar = (ImageView) pdfRowLayout.findViewById(R.id.pdf_avatar);
avatar.setImageBitmap(host.getDataProvider().getGroupItem(curGroupPosition).getGroupImage());
我明白,我需要等待,直到佈局是與特定的聽衆完全充氣。但是,我是否必須等待所有數據才能調整佈局大小?
請參閱[this](http://stackoverflow.com/questions/4680499/how-to-get-the-width-and-height-of-an-android-widget-imageview)post獲取視圖的寬度/運行時的高度。 –