简体   繁体   中英

CusrsorAdapter extend two static class to hold two views

I have cursor adapter which extends one static class with one View

public class CursorRecyclerViewAdapter extends CursorAdapter<CursorRecyclerViewAdapter.CursorHolder> {
    @Override
    public CursorHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View itemView = LayoutInflater.from(parent.getContext())
                .inflate(id, parent, false);
      return new CursorHolder(itemView, parent)
    }
}
static class CursorHolder extends RecyclerView.ViewHolder {
}
static class CursorHolder2 extends RecyclerView.ViewHolder {
}

How can i return on onCreateViewHolder CursorHolder2 or CursorHolder? Because I need to have two Views in this CursorRecyclerViewAdapter.

Can I somehow add to CursorAdapter<CursorRecyclerViewAdapter.CursorHolder> additional CursorRecyclerViewAdapter.CursorHolder2 ?

In my case best solution is to use ConcatAdapter.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM