无法解析方法膨胀(android.context.Context)

时间:2018-10-03 05:43:36

标签: java android android-recyclerview recycler-adapter

我遇到这种方法的问题,它说Cannot resolve method inflate(android.context.Context)

@Override
public exViewHolder onCreateViewHolder(ViewGroup parent,int viewType){
    View view= LayoutInflater.inflate(parent.getContext()).inflate(R.layout.custom_thighlayout,parent,false);
    exViewHolder evh=new exViewHolder(view);  return evh;
}

1 个答案:

答案 0 :(得分:1)

替换

View view= LayoutInflater.inflate(parent.getContext()).inflate(R.layout.custom_thighlayout,parent,false);

使用

View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.custom_thighlayout,parent,false);