简体   繁体   中英

Scrolling is not smooth for android app

I made a gallery by referencing this site http://www.androidhive.info/2013/09/android-fullscreen-image-slider-with-swipe-and-pinch-zoom-gestures/

The issue I am facing is when i scroll down the scrolling is not smooth.

Have not done any custom modification, all the code is same as the code in above link.

Is their a problem with the code in GridViewAdapter class?

This happens because these blocking the UI thread.

You need make it background (other thread) some of the tasks that you are using to retrieve your bitmap.

I recomend you use a library like picasso or other.

Piccaso

String photoPath= "/android_asset/DvpvklR.png";    
Picasso.with(context).load("file://"+ photoPath).into(imageView);

Your class GridViewImageAdapter in your method getView!

Picasso.with(context).load("file://"+ _filePaths.get(position))
.into(imageView);

removes code that does not need.

More about Piccaso http://square.github.io/picasso/

Note remember import the library.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM