android - Compressing multiple RecyclerView items into one textview to expand when clicked -


what i'm trying show recyclerview list of both types , subtypes, subtypes represented textview when clicked show these items , act do, current recyclerview shows types , subtypes after each one

private class typeadapter extends recyclerview.adapter<typeholder> {      private list<type> mtypes;      public typeadapter(list<type> types) {         mtypes = types;     }      @override     public typeholder oncreateviewholder(viewgroup parent, int viewtype) {             layoutinflater layoutinflater = layoutinflater.from(getactivity());         view v = layoutinflater.inflate(r.layout.list_item_type, parent, false);         return new typeholder(v);     }      @override     public void onbindviewholder(typeholder holder, int position) {         type type = mtypes.get(position);         holder.bindtype(type);     }      @override     public int getitemcount() {         return mtypes.size();     } }  private class typeholder extends recyclerview.viewholder implements view.onclicklistener {      private textview mtitletextview;     private imageview mchildimageview;     private type mtype;      private typeholder(view v) {         super(v);         v.setonclicklistener(this);         mtitletextview = (textview) v.findviewbyid(r.id.list_item_type_title);     }      public void bindtype(type type){         mtype = type;         mtitletextview.settext(mtype.gettitle());          // show image if subtype         if(mtype.issubtype()) {             mchildimageview.setvisibility(view.visible);         } else {             mchildimageview.setvisibility(view.gone);         }     }      @override     public void onclick(view v) {         typeclickevent(mtype);     } } 

this example if want do, in application apply ones more 2 subtypes, want regardless of number of subtypes

moneylover example


Comments

Popular posts from this blog

PHP and MySQL WP -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

go - golang pprof for c library code -