2016-02-13 72 views
0

我正在使用RecyclerViewParseRecyclerView我已經創建了一個適配器來從解析雲中加載文本。我得到的錯誤與查看不能適用於PhotoFilterViewHolder使用RecyclerView進行解析

@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從解析雲景項目

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); 
    } 
} 

回答

0

想通了錯誤!除去FilterImages從PhotoFilterViewHolder張貼

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; 
     } 
    } 
0
返回

「視圖」 對象,而不是新的PhotoFilterViewHolder(視圖);