使用RecyclerView进行解析

时间:2016-02-13 12:07:04

标签: android parse-platform android-recyclerview

我正在使用RecyclerViewParseRecyclerView我创建了一个适配器来加载来自解析云的文本。我收到错误的视图无法应用于PhotoFilterViewHolder

@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    final View view = LayoutInflater.from(context).inflate(R.layout.item_photo_filter, parent, false);
    return new PhotoFilterViewHolder(view);
}

我正在使用PhotoFilterViewHolder查看Parse Cloud中的项目

public static class PhotoFilterViewHolder extends RecyclerView.ViewHolder {

    public PhotoFilterViewHolder(FilterImages post, View view) {
        super(view);
        PlaceName = (TextView) view.findViewById(R.id.place_names);
        PlaceName.setText(post.getPlaceName());
        ButterKnife.bind(this, view);
    }
}

2 个答案:

答案 0 :(得分:0)

弄清楚错误!从PhotoFilterViewHolder中删除了FilterImages帖子

public static class PhotoFilterViewHolder extends RecyclerView.ViewHolder {

            public PhotoFilterViewHolder(View view) {
                super(view);
                FilterImages post = new FilterImages();
                PlaceName = (TextView) view.findViewById(R.id.place_names);
                PlaceName.setText(post.getPlaceName());
                ButterKnife.bind(this, view);
            }

            @ParseName("PlaceName")
            public TextView PlaceName;
        }
    }

答案 1 :(得分:0)

返回"查看"对象而不是新的PhotoFilterViewHolder(view);