java - 无法从静态上下文中引用非静态方法 'inflate(byte[],int,int)'

标签 java android

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    view= Inflater.inflate(R.layout.reg_book,container,false);
    return view;
    }

上下文:我是 android 的新手,我遇到了“无法从静态上下文引用非静态方法”的错误。错误显示在“.inflate”。

最佳答案

改变这一行

view= Inflater.inflate(R.layout.reg_book,container,false);

view= inflater.inflate(R.layout.reg_book,container,false);

关于java - 无法从静态上下文中引用非静态方法 'inflate(byte[],int,int)',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44025580/

相关文章:

java - 获取设备 ID 以显示 Admob 插页式广告

android - 离线打开 Phonegap/Cordova 应用程序

android - Libgdx:AssetManager 未加载 Assets

java - 线程中的死锁情况?

java - 无法从 xml 文件正确获取本地化字符串

java - Spring 食谱书: AOP issue

java - 后台服务始终运行

java - 我需要我的 textView 在一行中适合屏幕。 android 中是否有类似 autoResize 的功能?

java - 错误 :Android Pre Dex: Android SDK is not specified

java - 如何提高 oracle 中简单选择查询的性能