繁体   English   中英

等到视图完全更新后:如何?

[英]Wait till the view is fully updated: How to?

我正在放大一个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());

我知道我需要等到特定听众将布局完全膨胀为止。 但是我是否必须等待所有数据重新调整布局大小?

您可以简单地使用片段/活动的onResume()侦听器,此方法使片段/活动开始与用户交互,这意味着该片段对于用户是完全可见的。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM