0

I have a fully functional listview (in a ListFragment) with a custom ArrayAdapter. The layout of the adapter consists of an imageview, a button, a gridview and a couple of textviews.
The problem is the listview is very jittery while scrolling. I have implemented the ViewHolder pattern and it improved the performance just a little.
The GridView consists of contact images which i am retrieving in a AsyncTask and also using application cache to display the bitmaps. What else can i do to make this listview scroll smooth?
I have used view recycling as shown below in my getView method of the adapter

public View getView(int position, View convertView, ViewGroup parent) {
    View myView;
    holder = new ViewHolder();
    if (convertView == null) {
        inflater = (LayoutInflater) getContext().getSystemService(
                                  Context.LAYOUT_INFLATER_SERVICE);
        myView = inflater.inflate(R.layout.events_list_activity, parent, false);
    }
    else {
        myView = convertView;
    }
}
JJD
  • 50,076
  • 60
  • 203
  • 339
SKen
  • 612
  • 1
  • 10
  • 20
  • Have you correctly recycled the `View`s used in each item of your `ListView`? – btalb Jan 05 '13 at 09:50
  • You have a `GridView` in every single row of your `ListView`? If that's the case, then my next guess is that the touch action of scrolling is being delegated to the `GridView` child which makes it jittery. Try turning touch actions off for all of your `GridView`s and see if that helps, then try removing all of the `GridView`s and see if the problem is gone. Without much code, all we can do is take guesses ;) – btalb Jan 07 '13 at 01:14

3 Answers3

1

This question might have explanation for jittery behaviour of your list view.

If you are looking to improve scrolling speed, try this,

getListView().setFastScrollEnabled(true);
Community
  • 1
  • 1
Sahil Mahajan Mj
  • 11,033
  • 8
  • 53
  • 100
  • Nope it doesn't help as i have already taken care of all that. I don't have any heavy operations running on my Adapter. Also `setFastScrollEnabled` is not the solution as the listView will still be jittery while scrolling. – SKen Jan 05 '13 at 09:19
0

1.Flatten your ViewItem hierarchy & use merge tag

2.Implement ViewHolder pattern, or use inject feature of androidannotation

3.Do the heavyload in another thread.

Truong Nguyen
  • 86
  • 3
  • 12
-1

It will give you the scroll from top of your layout and also it'll give you smooth scrolling experience.

mainScrollView=(ScrollView)findViewById(R.id.scrollview);
mainScrollView.smoothScrollTo(0, 0);
mainScrollView.fullScroll(mainScrollView.FOCUS_UP);
GK_
  • 1,212
  • 1
  • 12
  • 26
  • 1
    yes but my issue is pertaining to a `listview`, how is a `scrollview` going to make any difference? – SKen Jan 05 '13 at 09:26