android - LayoutInflater.inflate() 是同步的吗?

标签 android layout-inflater

也就是说,它会立即以阻塞方式膨胀布局,并在返回之前调用onInflateFinished(),还是立即返回并安排稍后膨胀?

最佳答案

Inflate 是同步的。异步没意义,更何况获取返回值,会变得相当复杂。

See docs :

Returns:

The root View of the inflated hierarchy. If root was supplied, this is the root View; otherwise it is the root of the inflated XML file.

关于android - LayoutInflater.inflate() 是同步的吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13158320/

相关文章:

java - NullPointerException 在扩展 FragmentActivity 中声明 Intent

android - 取消绑定(bind) drawables onPause() 导致无响应的后退导航并跳过此步骤导致内存溢出

android - RecycleView 在 Fragment 中崩溃,因为 LayoutManager 为 NULL

android - 如何从膨胀的布局中访问 View ?

java - 通过辅助服务传递数据以查看 – Android

android - 集成 HalpStack 后生成签名的 APK 警告即将到来

Android LayoutInflater 问题

android - 打气筒有什么区别

android - 在适配器的构造函数中膨胀 xml 文件

android - 如何使用 layout inflatter 在另一个 View 中添加一个 View