【发布时间】:2015-11-05 15:55:17
【问题描述】:
我正在扩充一个 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 帖子以获取运行时视图的宽度/高度。
标签: android view layout-inflater