[TIMOB-28565] Android: ListView item containing several ImageViews can cause bad scroll performance as of 9.3.0
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | Medium |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2021-11-02T01:24:32.000+0000 |
| Affected Version/s | Release 9.3.0 |
| Fix Version/s | Release 10.2.0 |
| Components | Android |
| Labels | ImageView, ListView, android, performance, regression |
| Reporter | Joshua Quick |
| Assignee | Joshua Quick |
| Created | 2021-10-22T01:45:04.000+0000 |
| Updated | 2021-11-02T01:24:32.000+0000 |
Description
*Summary:*
If a
ListView item template contains a lot of ImageViews (say 16 or more), then this can cause bad scroll performance as of Titanium 9.3.0.
This issue is caused by the number of image views. The more image views a single list item has, the worse it gets... even if the no images are assigned (ie: empty image views).
*Steps to reproduce:*
Create a Classic app project from template. (Provides needed tab images.)
Use [^ListViewTemplateManyImagesTest.js] as the "app.js".
Build and run on Android.
Fling the ListView and note the scroll performance.
*Cause:* This issue is caused by theZoomControl added to every Ti.UI.ImageView [here](https://github.com/appcelerator/titanium_mobile/blob/ead1713e5e36b4632b692ce6fcc9a9785b91ad26/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiImageView.java#L143). Removing the ZoomControl solves the performance issue.
*Work-Around 1:*
Set ImageView property "touchEnabled" to false. This improves scroll performance, but "Work-Around 2" is even faster.
*Work-Around 2:*
Instead of using a Ti.UI.ImageView, use a Ti.UI.View and its backgroundImage instead... but this also means you need to hard-code the "width" and "height" properties to match the image size.
Attachments
| File | Date | Size |
|---|---|---|
| ListViewTemplateManyImagesTest.js | 2021-10-22T01:42:56.000+0000 | 1336 |
PR (master): https://github.com/appcelerator/titanium_mobile/pull/13146