TheAnimatrix
TheAnimatrix

Reputation: 604

Listview jumps to the bottom on scrolling fast

So as the title says , i have this problem with my listview . Im not using any ordinary listview , im using the observable scrollview library which is based on a listview .

Firstly, i would like to clarify a few things to give you guys more clarity.

  1. I didn't have this problem until i changed a couple of things with my listview's custom adapters layout.

  2. This seems wierd because i didn't get this problem before .

  3. It scrolls at an abnormal rate , i just fling and it hits the bottom suddenly.

  4. scrolling slowly doesn't cause the problem

  5. Should i slow down my listview and try , if so how ?

  6. I load more items on scroll , i have a footerview too and the footerview stays only a second or less .

Upvotes: 1

Views: 1024

Answers (2)

smilly92
smilly92

Reputation: 2443

This can also be caused by a bug in Android 5.1. The bug report can be found here. Two fast up swipes on a ListView cause it to hit the top of the list and then instantly scroll to the bottom.

Currently the only solution appears to be using a ScrollView instead of a ListView.

Upvotes: 3

Jonas Czech
Jonas Czech

Reputation: 12328

In your getView method, you have

inflater = (LayoutInflater) context
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);

View v = inflater.inflate(R.layout.custom, parent, false);

Replace with

if (convertView == null) {
    inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View v = inflater.inflate(R.layout.custom, parent, false);
}

And, it will be much better.

Btw, ViewHolder is not so hard. If this does not work, you have to implement ViewHolder correctly. Also avoid doing too much stuff in getView and make sure you load images asynchronously ( most imageLoader libraries will do this for you )

Upvotes: 0

Related Questions