gpt4 book ai didi

android - 使用 Context 获取 LayoutInflater

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:48:01 25 4
gpt4 key购买 nike

这两者有什么区别吗?

  1. inflater = (LayoutInflater) LayoutInflater.from(context);
  2. inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

最佳答案

目前还没有,正如您通过检查 the LayoutInflater source code 可以看到的那样. from() 将抛出一个 Exception 而不是返回 null,但除此之外它们是相同的。

就个人而言,我大部分时间都使用 getLayoutInflater()

关于android - 使用 Context 获取 LayoutInflater,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14022094/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com