Fragment 中使用 getLayoutInflater() 的问题

转载:https://blog.csdn.net/qq_33210042/article/details/75807989

解决方法:
如果是在一个 Fragment 中应该
getActivity().getLayoutInflater();
或者
LayoutInflater.from(getActivity());
也可以
View.inflate();
或者
LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

LayoutInflater作用及使用:
https://www.cnblogs.com/x_wukong/p/4337637.html

猜你喜欢

转载自blog.csdn.net/qq_39784713/article/details/88562610