我正在给一个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获取视图的宽度/运行时的高度。 –