Reputation: 10028
I have a ListView with each item being a custom layout with multiple Views (including a large image of ~445x250, a smaller image of ~40x40, etc). While scrolling, the animation is extremely choppy.
Can someone recommend how I can improve performance?
One approach I tried was to eliminate any transparency in the images being used. This did improve it slightly, though there is still a noticeable lag when before a new item scrolls into view.
Update: Here's the View heirarchy for the custom layout (for each item) - http://pastie.org/3333903
Upvotes: 2
Views: 2465
Reputation: 5151
Looking at the layout provided, there are a few things that may cause performance issues:
RelativeLayout
/TableLayout
where possible instead of nested LinearLayout
s.ListView
- if your rows start becoming complex, it may be a sign to look at something else to display this information.GestureOverlayView
seems a bit heavy for a ListView
row item. Is this necessary? Considering ListView
s a scrollable by touch, having custom gestures on row items may be a bit confusing. You can also try using android:persistentDrawingCache="scrolling"
and the ViewHolder pattern to squeeze out a bit more performance.
If you download the latest version of ADT, it will also guide you in optimising your layouts.
Apart from layout optimisations, minimal work should be done in the getView
method of your ListAdapter
.
Additionally, you can use android:hardwareAccelerated="true"
to take advantage of hardware in Android 3.0+.
Upvotes: 3
Reputation: 875
You can use the dynamic table layout instead using the List view. It will improve the performance. Dynamic table layout will adjust the large image and smaller image. It will be of help to you.
Upvotes: 0