Scrolling lags significantly on Android


#1

Scrolling in my app on android 4.4.4 phone lags quite significantly but on iOS it is smooth. However on android 5 simulator it is smooth as well.
Are there any solutions to this?

PS: Im on 1.0.1, with CLI 1.6.1.


#2

Have you turned on native scrolling for the Android platform?

angular.module('ionicApp', ['ionic']).config(function($ionicConfigProvider) {
  if (!ionic.Platform.isIOS()) {
    $ionicConfigProvider.scrolling.jsScrolling(false);
  }
})

#3

Just added that and tried… it is still laggy…
But my phone is considered quite high end actually


#4

Then let’s look further.

Have you implemented collection Repeat directive?

The idea behind collection-repeat is that it renders only the items that are currently visible inside the viewport, so if you have 2000 items but only 10 items fit into your screen than 10 items will be rendered instead of 2000 (The problem with the performance of huge lists is usually the painting in the browser).

http://ionicframework.com/docs/api/directive/collectionRepeat/


#5

Thanks for the followup, I have heard about the collectionrepeat before, I will definitely use it later when I have actual data pulling into the app.
For now my page is does not have much going on… a few grids and a few list & card rows… so collectionrepeat may not be the answer for this moment…


#6

Ok, can you please describe at what point scrolling is lagging in your app?

I would like to know a context of your problem.


#7

It lags quite a bit in a few pages, the most basic example where it lags is that I have a page with one card(header+ basic text content) and another card(header + content of an accordion with 4 titles and 6 subitems in each).

And http://codepen.io/ionic/pen/uJkCz is where I get the accordion…


#8

Have you tried crosswalk?


#9

Had a read about that before, but I do not want to increase my app size to drive away pre-android5.0 users…


#10

That’s right your apk will gain 15 MB, but your app will be faster and you won’t have to deal with differences in CSS support between all Android versions.
I did test it on 4.4 and was immediately convinced.


#11

Thanks, but I still wonder if there is a way to make the app smaller after incorporating crosswalk?


#12

Not really as the apk embeds Chromium