Gridview shows the progress of loading androidprogressbar when loading images asynchronously <br>

DC

GridView loads images asynchronously, each view shows the progress bar progress... The gallery is still using this method to avoid the picture without load – when it cannot slide.




Cima Motor

Gridview layout file:









High voltage motor

Item gridview_item layout file. XML:





When the image shows progress:

Public view getview (int position, view convertviewviewgroup parent) {if (convertview==null) {layoutinflaterlayoutinflater=layoutinflater. From (mmainactivity); Convertview=layoutinflater. Inflatable (r.layout.Gridview_item,null);gridview. Layoutparamsparams=New display data table. Layoutparams(mmainactivityalbumwidthmmainactivity.Albumheight);Convertview. Setlayoutparams(params);}convertview. Settag (position) ;/ / progress bar shows the first progressbarpb = (progressbar) convertview. Findviewbyid(r.i.d.grid_progressbar);lead. Setvisibility (visible); ImageviewImageview=(Imageviewconvertview). Findviewbyid(r.i.d.grid_imageview);Imageview. Setscaletype(imageview.Scaletype.Center_inside);Imageview. Setadjustviewbounds(true); Syntask. Loadimage(position, imageurls.Get(position), imageloadlistener); returned image //async convertview;}


Hide the progress bar after loading the picture:
The view of the view = mgridview (view). Findviewwithtag(t); if (view!=null) {// hide progress bar progressbarpb=(progressbar) view. Findviewbyid(r.i.d.grid_progressbar);lead. Setvisibility (reason);//The displayed image is loaded into the imageviewimageview=(imageview) view. Findviewbyid(r.i.d.grid_imageview);Imageview. Setbackgrounddrawable(movable);}














Copyright Statement: The original blog post in this article cannot be reproduced without the consent of the blogger.

Android asynchronous messaging framework

TDF Corners

TDC / TDF Corners,TDF & TDC Corners,TDF Duct Corner,TDC duct connection

Ningbo Gemu Ventilation Technology Compnay Limited , https://www.golmacool.com