コード例 #1
0
 @Override
 public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
   if (isEmpty()) {
     ViewHolder holder;
     if (mEmptyView != null) {
       holder = ViewHolder.createViewHolder(parent.getContext(), mEmptyView);
     } else {
       holder = ViewHolder.createViewHolder(parent.getContext(), parent, mEmptyLayoutId);
     }
     return holder;
   }
   return mInnerAdapter.onCreateViewHolder(parent, viewType);
 }
コード例 #2
0
  @Override
  public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    if (mHeaderViews.get(viewType) != null) {
      ViewHolder holder =
          ViewHolder.createViewHolder(parent.getContext(), mHeaderViews.get(viewType));
      return holder;

    } else if (mFootViews.get(viewType) != null) {
      ViewHolder holder =
          ViewHolder.createViewHolder(parent.getContext(), mFootViews.get(viewType));
      return holder;
    }
    return mInnerAdapter.onCreateViewHolder(parent, viewType);
  }