android - SIze Imageview Placeholders -
i using recyclerview imageviews in each cell.each imageview loads images web , can square or more width height or more height width i.e sizes.i going display placeholder each image while loads in background(with progressbar).but problem dimension of images unknown , want size placeholders size of images 9gag app in placeholders size of images while loading in bacground.how achieve in android ?i don't want use wrap-content(produces jarring effect after image has been downloaded) or specific height imageviews(crops images).i using uil , planning switch fresco or picassa.
if use fresco, need pass width , height of image web server, set layout params of drawee view width , height.
like this:
relativelayout.layoutparams draweeparams = new relativelayout.layoutparams(desiredimagewidthpixel, desiredimageheightpixel); yourdraweeview.setlayoutparams(draweeparams);
from width , height of image pass web server, can calculate/resize proportionally view need. desiredimagewidthpixel calculated image width want show in yourdraweeview , desiredimageheightpixel calculated image height want show in yourdraweeview.
don't forget call
yourdraweeview.gethierarchy().setactualimagescaletype(scalingutils.scaletype.fit_xy);
to make yourdraweeview match actual params set before. hope helps
Comments
Post a Comment