不能从静态上下文引用非静态方法'inflate(byte[],int,int)'


@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的初学者,我遇到了" 无法从静态上下文引用非静态方法"的错误。错误显示在" .fexpand '处。

更改此行

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

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

作为onCreateView参数列表的一部分,您会收到LayoutInflater inflater

在上述inflater变量上调用.inflate(R.layout.reg_book,container,false)

最新更新