how to change image in Recycler View in android (like a radio button)? -


i having recycler view. it's grid view. total of 9 images in grid layout. if click image in 1 of above, image have change image. if click image. last 1 want reset. clicked image alone change highlighted image.
here code...

holder.mlayout.setonclicklistener(new view.onclicklistener() {         @override public void onclick(view view) {              //for (int = 0; < data_collection.size(); i++) {                  holder.mlayout.setvisibility(view.visible);                 holder.mhighlighted.setvisibility(view.gone);                 if (position == i) {                  }             //}             holder.mlayout.setvisibility(view.gone);             holder.mhighlighted.setvisibility(view.visible);              mhighlight.onhighlight(position, view);         }     }); 

remove dont need.

@override public void onbindviewholder(final simpleviewholder holder, final int position) {      holder.textview.settext(elements.get(position).getname());     holder.textview.settypeface(typeface1);     circularimageview circularimageview = (circularimageview) holder.linearlayout.findviewbyid(r.id.personazhe_layout_grid_item_image);     //  if (build.version.sdk_int >= build.version_codes.jelly_bean) {     //    circularimageview.setbackground(elements.get(position).getphoto());     //  } 

circularimageview.setimagedrawable(elements.get(position).getprofileimage()); //picasso.with(context).load(elements.get(position).getprofileimage()).into(circularimageview); holder.linearlayout.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view) {

            if(pos != position){               c.setimagedrawable(elements.get(position).getprofileimage());             t.settext(elements.get(position).getname());             seekbar.setprogress(0);             pos = position;             }              //image = elements.get(position).getprofileimage();             // textviews           //  trajneri = elements.get(position).gettrajneri();          //   mosha = elements.get(position).getmosha();           //  vendbanimi = elements.get(position).getvendbanimi();           //  vendlindja = elements.get(position).getvendlindja();           //  arsimi = elements.get(position).getarsimi();           //  name = elements.get(position).getname();            // surname = elements.get(position).getsurname();            // pos = elements.get(position).number();           //  posi = position;             //  button.performclick();         }     }); } 

Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -