android - how to handle list of images(horizontal) inside cardview in recylerview? -
i want create below design, because of have created dynamic image views , fetch image urls using glide lib. loading images slow
holder.linearlayout.removeallviews(); for(int k = 0; k < getpiclist().size(); k++) { imageview imageview = new imageview(holder.linearlayout.getcontext()); linearlayout.layoutparams params = new linearlayout.layoutparams(90, 90); params.setmargins(0,0,10,0); imageview.setlayoutparams(params); getpic(holder.linearlayout, imageview, requestdata.getpiclist().get(k).getpic()); } private void getpic(final linearlayout linearlayout, final imageview imageview, string imageurl){ // log.d(tag,imageurl); if (imageurl != null) { // loading profile image glide.with(context).load(imageurl) // .crossfade() .dontanimate() .priority(priority.immediate) .signature(new stringsignature(string.valueof(system.currenttimemillis()))) // .placeholder() .error(r.drawable.ic_error_image_load) .thumbnail(0.5f)//size multiplier must 0 , 1 .bitmaptransform(new circletransform(context)) .diskcachestrategy(diskcachestrategy.all) .into(new simpletarget<glidedrawable>() { @override public void onresourceready(glidedrawable resource, glideanimation<? super glidedrawable> glideanimation) { imageview.setimagedrawable(resource); linearlayout.addview(imageview); } }); } else { // make sure glide doesn't load view until told otherwise glide.clear(employee_img); // remove placeholder (optional); read comments below employee_img.setimagedrawable(null); } }
is right way choose dynamic image views kind of ui, or there other alternative?
Comments
Post a Comment