android– 使用Context获取LayoutInflater

android– 使用Context获取LayoutInflater,第1张

概述这两者有什么区别吗?> inflater =(LayoutInflater)LayoutInflater.from(context);> inflater =(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);最佳答案目前还没有,正如你可以通过检查th

这两者有什么区别吗?

> inflater =(LayoutInflater)LayoutInflater.from(context);
> inflater =(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);最佳答案目前还没有,正如你可以通过检查the LayoutInflater source code看到的那样.来自()将抛出异常而不是返回null,但是否则它们是相同的.

就个人而言,我大多数时候都使用getLayoutInflater().

总结

以上是内存溢出为你收集整理的android – 使用Context获取LayoutInflater全部内容,希望文章能够帮你解决android – 使用Context获取LayoutInflater所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1140153.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-31
下一篇 2022-05-31

发表评论

登录后才能评论

评论列表(0条)

保存