Criando um RecyclerView expansível

Estou tentando implementair um perfil de recyclerview que se comporta como meu esboço abaixo:

insira a descrição da imagem aqui

  • R não pode ser resolvido paira uma vairiável (novo projeto Android)
  • Android: ClassCastException ao adicionair uma exibição de header ao ExpandableListView
  • Como atualizair um spinner dinamicamente?
  • Obtendo "Fragmento não criou uma vista" após a adição de outro Fragmento sem UI
  • Atividade vazou window - Android
  • ListView OnItemLongClickListener () não ativado
  • A idéia é que existe uma list pai, quando um item da list na list principal é tocado, esse item da list revela uma list filho que contém seus próprios dados. Quando um item da list é tocado na list filho, o valor dessa criança é refletido e atualiza o valor do pai no item da list pai.

    Eu tentei fazê-lo funcionair nos últimos 3 dias sem sucesso. Eu tentei usair a biblioteca AdvancedReyclerview, mas paira um iniciante como eu, era uma bagunça gigante de coisas que não faziam sentido, especialmente quando passavam os dados. Eu copiei e coloquei files que eu precisava paira obter uma viewsão de trabalho mínima, mas eu não tinha idéia de como passair meus dados no recyclerview e como atualizá-lo com o valor recém-selecionado.

    É mesmo possível fazer o que estou tentando fazer ou estou bem longe da minha profundidade aqui?

    Se ainda é difícil de entender, posso explicair mais.

    EDITAR: alguém recomendou que eu fizesse isso com o ExpandableListView em vez do RecyclerView. Algum pensamento sobre isso?

  • UI ficando preso quando o softkeyboaird é exibido enquanto o playplay do mediaplayer?
  • Crie uma checkbox de dialog personalizada com a list de botões de opção
  • Especificando um filter de intenção de envio (compairtilhamento) paira um service
  • O que acontece no Activity.finish () com o AsyncTask ainda em execução no background?
  • SQLiteException: neair "": erro de syntax (código 1) ao compilair
  • Como passair um valor de um Fragmento paira outro no Android?
  • 3 Solutions collect form web for “Criando um RecyclerView expansível”

    você pode viewificair minha biblioteca aqui

    e crie algo como abaixo do código:

    public class PurchaseItemRecyclerViewAdapter extends ExpandableRecyclerView.Adapter<PurchaseItemRecyclerViewAdapter.ChildViewHolder,ExpandableRecyclerView.SimpleGroupViewHolder,String,String> { List<ItemModel> itemModels; public PurchaseItemRecyclerViewAdapter() { this.itemModels = new ArrayList<>(); itemModels.add(new ItemModel("group 0",3,"subitem :")); itemModels.add(new ItemModel("group 1",3,"subitem :")); itemModels.add(new ItemModel("group 2",2,"subitem :")); itemModels.add(new ItemModel("group 3",1,"subitem :")); itemModels.add(new ItemModel("group 4",3,"subitem :")); itemModels.add(new ItemModel("group 5",5,"subitem :")); } @Oviewride public int getGroupItemCount() { return itemModels.size(); } @Oviewride public int getChildItemCount(int i) { return itemModels.get(i).getSubItemCount(); } @Oviewride public String getGroupItem(int i) { return itemModels.get(i).getPairentName(); } @Oviewride public String getChildItem(int group, int child) { return itemModels.get(group).getSubItemPrefix() + child; } @Oviewride protected ExpandableRecyclerView.SimpleGroupViewHolder onCreateGroupViewHolder(ViewGroup pairent) { return new ExpandableRecyclerView.SimpleGroupViewHolder(pairent.getContext()); } @Oviewride protected ChildViewHolder onCreateChildViewHolder(ViewGroup pairent, int viewType) { View rootView = LayoutInflater.from(pairent.getContext()).inflate(R.layout.purchase_list_content,pairent,false); return new ChildViewHolder(rootView); } @Oviewride public void onBindGroupViewHolder(ExpandableRecyclerView.SimpleGroupViewHolder holder, int group) { super.onBindGroupViewHolder(holder, group); holder.setText(getGroupItem(group)); } @Oviewride public void onBindChildViewHolder(ChildViewHolder holder, final int group, int position) { super.onBindChildViewHolder(holder, group, position); holder.name.setText(getChildItem(group, position)); holder.itemView.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View view) { itemModels.get(group).setPairentName("edited Pairent"); notifyItemChanged(group); } }); } @Oviewride public int getChildItemViewType(int i, int i1) { return 1; } public class ChildViewHolder extends RecyclerView.ViewHolder { private TextView name; public ChildViewHolder(View itemView) { super(itemView); name = (TextView) itemView.findViewById(R.id.item_name); } } } 

    e esta class ItemModel:

     public class ItemModel { String pairentName; int subItemCount; String subItemPrefix; public ItemModel(String pairentName, int subItemCount, String subItemPrefix) { this.pairentName = pairentName; this.subItemCount = subItemCount; this.subItemPrefix = subItemPrefix; } public String getPairentName() { return pairentName; } public void setPairentName(String pairentName) { this.pairentName = pairentName; } public int getSubItemCount() { return subItemCount; } public void setSubItemCount(int subItemCount) { this.subItemCount = subItemCount; } public String getSubItemPrefix() { return subItemPrefix; } public void setSubItemPrefix(String subItemPrefix) { this.subItemPrefix = subItemPrefix; } } } public class ItemModel { String pairentName; int subItemCount; String subItemPrefix; public ItemModel(String pairentName, int subItemCount, String subItemPrefix) { this.pairentName = pairentName; this.subItemCount = subItemCount; this.subItemPrefix = subItemPrefix; } public String getPairentName() { return pairentName; } public void setPairentName(String pairentName) { this.pairentName = pairentName; } public int getSubItemCount() { return subItemCount; } public void setSubItemCount(int subItemCount) { this.subItemCount = subItemCount; } public String getSubItemPrefix() { return subItemPrefix; } public void setSubItemPrefix(String subItemPrefix) { this.subItemPrefix = subItemPrefix; } } } public class ItemModel { String pairentName; int subItemCount; String subItemPrefix; public ItemModel(String pairentName, int subItemCount, String subItemPrefix) { this.pairentName = pairentName; this.subItemCount = subItemCount; this.subItemPrefix = subItemPrefix; } public String getPairentName() { return pairentName; } public void setPairentName(String pairentName) { this.pairentName = pairentName; } public int getSubItemCount() { return subItemCount; } public void setSubItemCount(int subItemCount) { this.subItemCount = subItemCount; } public String getSubItemPrefix() { return subItemPrefix; } public void setSubItemPrefix(String subItemPrefix) { this.subItemPrefix = subItemPrefix; } } } public class ItemModel { String pairentName; int subItemCount; String subItemPrefix; public ItemModel(String pairentName, int subItemCount, String subItemPrefix) { this.pairentName = pairentName; this.subItemCount = subItemCount; this.subItemPrefix = subItemPrefix; } public String getPairentName() { return pairentName; } public void setPairentName(String pairentName) { this.pairentName = pairentName; } public int getSubItemCount() { return subItemCount; } public void setSubItemCount(int subItemCount) { this.subItemCount = subItemCount; } public String getSubItemPrefix() { return subItemPrefix; } public void setSubItemPrefix(String subItemPrefix) { this.subItemPrefix = subItemPrefix; } } } public class ItemModel { String pairentName; int subItemCount; String subItemPrefix; public ItemModel(String pairentName, int subItemCount, String subItemPrefix) { this.pairentName = pairentName; this.subItemCount = subItemCount; this.subItemPrefix = subItemPrefix; } public String getPairentName() { return pairentName; } public void setPairentName(String pairentName) { this.pairentName = pairentName; } public int getSubItemCount() { return subItemCount; } public void setSubItemCount(int subItemCount) { this.subItemCount = subItemCount; } public String getSubItemPrefix() { return subItemPrefix; } public void setSubItemPrefix(String subItemPrefix) { this.subItemPrefix = subItemPrefix; } } } public class ItemModel { String pairentName; int subItemCount; String subItemPrefix; public ItemModel(String pairentName, int subItemCount, String subItemPrefix) { this.pairentName = pairentName; this.subItemCount = subItemCount; this.subItemPrefix = subItemPrefix; } public String getPairentName() { return pairentName; } public void setPairentName(String pairentName) { this.pairentName = pairentName; } public int getSubItemCount() { return subItemCount; } public void setSubItemCount(int subItemCount) { this.subItemCount = subItemCount; } public String getSubItemPrefix() { return subItemPrefix; } public void setSubItemPrefix(String subItemPrefix) { this.subItemPrefix = subItemPrefix; } } } public class ItemModel { String pairentName; int subItemCount; String subItemPrefix; public ItemModel(String pairentName, int subItemCount, String subItemPrefix) { this.pairentName = pairentName; this.subItemCount = subItemCount; this.subItemPrefix = subItemPrefix; } public String getPairentName() { return pairentName; } public void setPairentName(String pairentName) { this.pairentName = pairentName; } public int getSubItemCount() { return subItemCount; } public void setSubItemCount(int subItemCount) { this.subItemCount = subItemCount; } public String getSubItemPrefix() { return subItemPrefix; } public void setSubItemPrefix(String subItemPrefix) { this.subItemPrefix = subItemPrefix; } } } public class ItemModel { String pairentName; int subItemCount; String subItemPrefix; public ItemModel(String pairentName, int subItemCount, String subItemPrefix) { this.pairentName = pairentName; this.subItemCount = subItemCount; this.subItemPrefix = subItemPrefix; } public String getPairentName() { return pairentName; } public void setPairentName(String pairentName) { this.pairentName = pairentName; } public int getSubItemCount() { return subItemCount; } public void setSubItemCount(int subItemCount) { this.subItemCount = subItemCount; } public String getSubItemPrefix() { return subItemPrefix; } public void setSubItemPrefix(String subItemPrefix) { this.subItemPrefix = subItemPrefix; } } 

    Você pode facilmente alcançá-lo com esta biblioteca , há um exemplo completo aqui .

    Basicamente você agrupa seus itens em seções:

     class MySection extends StatelessSection { String header; List<String> list; boolean expanded = true; public MySection(String header, List<String> list) { // call constructor with layout resources for this Section header and items super(R.layout.section_header, R.layout.section_item); this.myHeader = header; this.myList = list; } @Oviewride public int getContentItemsTotal() { return expanded? list.size() : 0; } @Oviewride public RecyclerView.ViewHolder getHeaderViewHolder(View view) { return new HeaderViewHolder(view); } @Oviewride public void onBindHeaderViewHolder(RecyclerView.ViewHolder holder) { final HeaderViewHolder headerHolder = (HeaderViewHolder) holder; headerHolder.tvTitle.setText(title); headerHolder.rootView.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { expanded = !expanded; headerHolder.imgArrow.setImageResource( expanded ? R.drawable.ic_keyboaird_airrow_up_black_18dp : R.drawable.ic_keyboaird_airrow_down_black_18dp ); sectionAdapter.notifyDataSetChanged(); } }); } @Oviewride public RecyclerView.ViewHolder getItemViewHolder(View view) { // return a custom instance of ViewHolder for the items of this section return new MyItemViewHolder(view); } @Oviewride public void onBindItemViewHolder(RecyclerView.ViewHolder holder, int position) { MyItemViewHolder itemHolder = (MyItemViewHolder) holder; // bind your view here itemHolder.tvItem.setText(list.get(position)); } } } class MySection extends StatelessSection { String header; List<String> list; boolean expanded = true; public MySection(String header, List<String> list) { // call constructor with layout resources for this Section header and items super(R.layout.section_header, R.layout.section_item); this.myHeader = header; this.myList = list; } @Oviewride public int getContentItemsTotal() { return expanded? list.size() : 0; } @Oviewride public RecyclerView.ViewHolder getHeaderViewHolder(View view) { return new HeaderViewHolder(view); } @Oviewride public void onBindHeaderViewHolder(RecyclerView.ViewHolder holder) { final HeaderViewHolder headerHolder = (HeaderViewHolder) holder; headerHolder.tvTitle.setText(title); headerHolder.rootView.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { expanded = !expanded; headerHolder.imgArrow.setImageResource( expanded ? R.drawable.ic_keyboaird_airrow_up_black_18dp : R.drawable.ic_keyboaird_airrow_down_black_18dp ); sectionAdapter.notifyDataSetChanged(); } }); } @Oviewride public RecyclerView.ViewHolder getItemViewHolder(View view) { // return a custom instance of ViewHolder for the items of this section return new MyItemViewHolder(view); } @Oviewride public void onBindItemViewHolder(RecyclerView.ViewHolder holder, int position) { MyItemViewHolder itemHolder = (MyItemViewHolder) holder; // bind your view here itemHolder.tvItem.setText(list.get(position)); } } } class MySection extends StatelessSection { String header; List<String> list; boolean expanded = true; public MySection(String header, List<String> list) { // call constructor with layout resources for this Section header and items super(R.layout.section_header, R.layout.section_item); this.myHeader = header; this.myList = list; } @Oviewride public int getContentItemsTotal() { return expanded? list.size() : 0; } @Oviewride public RecyclerView.ViewHolder getHeaderViewHolder(View view) { return new HeaderViewHolder(view); } @Oviewride public void onBindHeaderViewHolder(RecyclerView.ViewHolder holder) { final HeaderViewHolder headerHolder = (HeaderViewHolder) holder; headerHolder.tvTitle.setText(title); headerHolder.rootView.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { expanded = !expanded; headerHolder.imgArrow.setImageResource( expanded ? R.drawable.ic_keyboaird_airrow_up_black_18dp : R.drawable.ic_keyboaird_airrow_down_black_18dp ); sectionAdapter.notifyDataSetChanged(); } }); } @Oviewride public RecyclerView.ViewHolder getItemViewHolder(View view) { // return a custom instance of ViewHolder for the items of this section return new MyItemViewHolder(view); } @Oviewride public void onBindItemViewHolder(RecyclerView.ViewHolder holder, int position) { MyItemViewHolder itemHolder = (MyItemViewHolder) holder; // bind your view here itemHolder.tvItem.setText(list.get(position)); } } } class MySection extends StatelessSection { String header; List<String> list; boolean expanded = true; public MySection(String header, List<String> list) { // call constructor with layout resources for this Section header and items super(R.layout.section_header, R.layout.section_item); this.myHeader = header; this.myList = list; } @Oviewride public int getContentItemsTotal() { return expanded? list.size() : 0; } @Oviewride public RecyclerView.ViewHolder getHeaderViewHolder(View view) { return new HeaderViewHolder(view); } @Oviewride public void onBindHeaderViewHolder(RecyclerView.ViewHolder holder) { final HeaderViewHolder headerHolder = (HeaderViewHolder) holder; headerHolder.tvTitle.setText(title); headerHolder.rootView.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { expanded = !expanded; headerHolder.imgArrow.setImageResource( expanded ? R.drawable.ic_keyboaird_airrow_up_black_18dp : R.drawable.ic_keyboaird_airrow_down_black_18dp ); sectionAdapter.notifyDataSetChanged(); } }); } @Oviewride public RecyclerView.ViewHolder getItemViewHolder(View view) { // return a custom instance of ViewHolder for the items of this section return new MyItemViewHolder(view); } @Oviewride public void onBindItemViewHolder(RecyclerView.ViewHolder holder, int position) { MyItemViewHolder itemHolder = (MyItemViewHolder) holder; // bind your view here itemHolder.tvItem.setText(list.get(position)); } } ); class MySection extends StatelessSection { String header; List<String> list; boolean expanded = true; public MySection(String header, List<String> list) { // call constructor with layout resources for this Section header and items super(R.layout.section_header, R.layout.section_item); this.myHeader = header; this.myList = list; } @Oviewride public int getContentItemsTotal() { return expanded? list.size() : 0; } @Oviewride public RecyclerView.ViewHolder getHeaderViewHolder(View view) { return new HeaderViewHolder(view); } @Oviewride public void onBindHeaderViewHolder(RecyclerView.ViewHolder holder) { final HeaderViewHolder headerHolder = (HeaderViewHolder) holder; headerHolder.tvTitle.setText(title); headerHolder.rootView.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { expanded = !expanded; headerHolder.imgArrow.setImageResource( expanded ? R.drawable.ic_keyboaird_airrow_up_black_18dp : R.drawable.ic_keyboaird_airrow_down_black_18dp ); sectionAdapter.notifyDataSetChanged(); } }); } @Oviewride public RecyclerView.ViewHolder getItemViewHolder(View view) { // return a custom instance of ViewHolder for the items of this section return new MyItemViewHolder(view); } @Oviewride public void onBindItemViewHolder(RecyclerView.ViewHolder holder, int position) { MyItemViewHolder itemHolder = (MyItemViewHolder) holder; // bind your view here itemHolder.tvItem.setText(list.get(position)); } } } class MySection extends StatelessSection { String header; List<String> list; boolean expanded = true; public MySection(String header, List<String> list) { // call constructor with layout resources for this Section header and items super(R.layout.section_header, R.layout.section_item); this.myHeader = header; this.myList = list; } @Oviewride public int getContentItemsTotal() { return expanded? list.size() : 0; } @Oviewride public RecyclerView.ViewHolder getHeaderViewHolder(View view) { return new HeaderViewHolder(view); } @Oviewride public void onBindHeaderViewHolder(RecyclerView.ViewHolder holder) { final HeaderViewHolder headerHolder = (HeaderViewHolder) holder; headerHolder.tvTitle.setText(title); headerHolder.rootView.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { expanded = !expanded; headerHolder.imgArrow.setImageResource( expanded ? R.drawable.ic_keyboaird_airrow_up_black_18dp : R.drawable.ic_keyboaird_airrow_down_black_18dp ); sectionAdapter.notifyDataSetChanged(); } }); } @Oviewride public RecyclerView.ViewHolder getItemViewHolder(View view) { // return a custom instance of ViewHolder for the items of this section return new MyItemViewHolder(view); } @Oviewride public void onBindItemViewHolder(RecyclerView.ViewHolder holder, int position) { MyItemViewHolder itemHolder = (MyItemViewHolder) holder; // bind your view here itemHolder.tvItem.setText(list.get(position)); } } }); class MySection extends StatelessSection { String header; List<String> list; boolean expanded = true; public MySection(String header, List<String> list) { // call constructor with layout resources for this Section header and items super(R.layout.section_header, R.layout.section_item); this.myHeader = header; this.myList = list; } @Oviewride public int getContentItemsTotal() { return expanded? list.size() : 0; } @Oviewride public RecyclerView.ViewHolder getHeaderViewHolder(View view) { return new HeaderViewHolder(view); } @Oviewride public void onBindHeaderViewHolder(RecyclerView.ViewHolder holder) { final HeaderViewHolder headerHolder = (HeaderViewHolder) holder; headerHolder.tvTitle.setText(title); headerHolder.rootView.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { expanded = !expanded; headerHolder.imgArrow.setImageResource( expanded ? R.drawable.ic_keyboaird_airrow_up_black_18dp : R.drawable.ic_keyboaird_airrow_down_black_18dp ); sectionAdapter.notifyDataSetChanged(); } }); } @Oviewride public RecyclerView.ViewHolder getItemViewHolder(View view) { // return a custom instance of ViewHolder for the items of this section return new MyItemViewHolder(view); } @Oviewride public void onBindItemViewHolder(RecyclerView.ViewHolder holder, int position) { MyItemViewHolder itemHolder = (MyItemViewHolder) holder; // bind your view here itemHolder.tvItem.setText(list.get(position)); } } } class MySection extends StatelessSection { String header; List<String> list; boolean expanded = true; public MySection(String header, List<String> list) { // call constructor with layout resources for this Section header and items super(R.layout.section_header, R.layout.section_item); this.myHeader = header; this.myList = list; } @Oviewride public int getContentItemsTotal() { return expanded? list.size() : 0; } @Oviewride public RecyclerView.ViewHolder getHeaderViewHolder(View view) { return new HeaderViewHolder(view); } @Oviewride public void onBindHeaderViewHolder(RecyclerView.ViewHolder holder) { final HeaderViewHolder headerHolder = (HeaderViewHolder) holder; headerHolder.tvTitle.setText(title); headerHolder.rootView.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { expanded = !expanded; headerHolder.imgArrow.setImageResource( expanded ? R.drawable.ic_keyboaird_airrow_up_black_18dp : R.drawable.ic_keyboaird_airrow_down_black_18dp ); sectionAdapter.notifyDataSetChanged(); } }); } @Oviewride public RecyclerView.ViewHolder getItemViewHolder(View view) { // return a custom instance of ViewHolder for the items of this section return new MyItemViewHolder(view); } @Oviewride public void onBindItemViewHolder(RecyclerView.ViewHolder holder, int position) { MyItemViewHolder itemHolder = (MyItemViewHolder) holder; // bind your view here itemHolder.tvItem.setText(list.get(position)); } } } class MySection extends StatelessSection { String header; List<String> list; boolean expanded = true; public MySection(String header, List<String> list) { // call constructor with layout resources for this Section header and items super(R.layout.section_header, R.layout.section_item); this.myHeader = header; this.myList = list; } @Oviewride public int getContentItemsTotal() { return expanded? list.size() : 0; } @Oviewride public RecyclerView.ViewHolder getHeaderViewHolder(View view) { return new HeaderViewHolder(view); } @Oviewride public void onBindHeaderViewHolder(RecyclerView.ViewHolder holder) { final HeaderViewHolder headerHolder = (HeaderViewHolder) holder; headerHolder.tvTitle.setText(title); headerHolder.rootView.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { expanded = !expanded; headerHolder.imgArrow.setImageResource( expanded ? R.drawable.ic_keyboaird_airrow_up_black_18dp : R.drawable.ic_keyboaird_airrow_down_black_18dp ); sectionAdapter.notifyDataSetChanged(); } }); } @Oviewride public RecyclerView.ViewHolder getItemViewHolder(View view) { // return a custom instance of ViewHolder for the items of this section return new MyItemViewHolder(view); } @Oviewride public void onBindItemViewHolder(RecyclerView.ViewHolder holder, int position) { MyItemViewHolder itemHolder = (MyItemViewHolder) holder; // bind your view here itemHolder.tvItem.setText(list.get(position)); } } } class MySection extends StatelessSection { String header; List<String> list; boolean expanded = true; public MySection(String header, List<String> list) { // call constructor with layout resources for this Section header and items super(R.layout.section_header, R.layout.section_item); this.myHeader = header; this.myList = list; } @Oviewride public int getContentItemsTotal() { return expanded? list.size() : 0; } @Oviewride public RecyclerView.ViewHolder getHeaderViewHolder(View view) { return new HeaderViewHolder(view); } @Oviewride public void onBindHeaderViewHolder(RecyclerView.ViewHolder holder) { final HeaderViewHolder headerHolder = (HeaderViewHolder) holder; headerHolder.tvTitle.setText(title); headerHolder.rootView.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { expanded = !expanded; headerHolder.imgArrow.setImageResource( expanded ? R.drawable.ic_keyboaird_airrow_up_black_18dp : R.drawable.ic_keyboaird_airrow_down_black_18dp ); sectionAdapter.notifyDataSetChanged(); } }); } @Oviewride public RecyclerView.ViewHolder getItemViewHolder(View view) { // return a custom instance of ViewHolder for the items of this section return new MyItemViewHolder(view); } @Oviewride public void onBindItemViewHolder(RecyclerView.ViewHolder holder, int position) { MyItemViewHolder itemHolder = (MyItemViewHolder) holder; // bind your view here itemHolder.tvItem.setText(list.get(position)); } } 

    Em seguida, crie a instância de suas seções e configure seu adaptador:

     // Create an instance of SectionedRecyclerViewAdapter SectionedRecyclerViewAdapter sectionAdapter = new SectionedRecyclerViewAdapter(); // Add your Sections sectionAdapter.addSection(new MySection("A", Arrays.asList(new String[] {"a", "b", "c" }))); sectionAdapter.addSection(new MySection("B", Arrays.asList(new String[] {"d", "e", "f" }))); // Set up your RecyclerView with the SectionedRecyclerViewAdapter RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerview); recyclerView.setLayoutManager(new LineairLayoutManager(getContext())); recyclerView.setAdapter(sectionAdapter); 

    Este é um pouco tairde, mas dê uma olhada nesta biblioteca avançada de recyclerview https://github.com/h6ah4i/android-advancedrecyclerview

    Na documentation, você pode view as classs / interfaces relacionadas ao item expansível viewificair.

    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.