rbc*_*o17 0 android android-cardview android-recyclerview
所以我正在通过本教程
Android RecyclerView和CardView教程尝试使用recyclelerview的cardview上的这个教程.
当我在一个单独的测试应用程序中重新创建它并且它运行顺利时,一切都很好,但是当我尝试在我的主项目中实现它时它开始了产生这个错误.提前致谢
错误:(67,45)错误:不兼容的类型:视图无法转换为TextView
在客户适配器中
class PostViewHolder extends RecyclerView.ViewHolder{
TextView textname, textbody, textdate;
ImageView imageAvatar;
public PostViewHolder(View itemView)
{
super(itemView);
->these lines textname = itemView.findViewById(R.id.textname);
textbody = itemView.findViewById(R.id.textbody);
textdate = itemView.findViewById(R.id.textdate);
imageAvatar = itemView.findViewById(R.id.imageAvatar); <-
}
}
Run Code Online (Sandbox Code Playgroud)
把它们扔进去吧 TextView
textname = (TextView) itemView.findViewById(R.id.textname);
textbody = (TextView) itemView.findViewById(R.id.textbody);
textdate = (TextView) itemView.findViewById(R.id.textdate);
imageAvatar = (ImageView) itemView.findViewById(R.id.imageAvatar);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5335 次 |
| 最近记录: |