timeshift117
timeshift117

Reputation: 1800

WebView slow scrolling

For some reason the WebView I am using is quite slow, I don't have to much of a problem with the loading times for web pages, although if there is a way to improve that I would appreciate it. But my main concern is the jagged laggy scrolling. I'm reasonably sure there must be a way to get it working more smoothly, as other apps using (I assume) the WebView don't have this problem. I suppose it may be possible that these other apps are using some private web client although it seems to me very unlikely that all of them would. Others have asked similar questions on SO, but none of the answers are particularly effective.

Upvotes: 3

Views: 9091

Answers (3)

ozanurkan
ozanurkan

Reputation: 419

i think you have this code in your manifests

android:hardwareAccelerated="false"
android:largeHeap="true"

you have to delete if you have it.

Upvotes: 6

Scott Lin
Scott Lin

Reputation: 21

webView.setLayerType(View.LAYER_TYPE_HARDWARE, null);

This work for me.

Upvotes: 2

marcin.kosiba
marcin.kosiba

Reputation: 3231

It's really hard to guess what your problem might be given the amount of information you have provided:

  1. Did you declare that you want software rendering in your application's manifest (or by setting the WebView's layer type)? Maybe try hardware mode.
  2. What is the page that you're trying to load? Maybe there's tons of CSS/JavaScript going on there? Does a simpler page scroll well?
  3. Which version of Android are you seeing this on, have you tried others? Maybe this is specific to a device?
  4. Is the scroll not smooth (are you not hitting 60fps) or is there a large lag between the finger moving an the page moving? If it's the latter - maybe you have touch handlers slowing things down.

The above is just stuff from the top of my head. There are great articles out there on the topic, such as this one. Also, if you're using the Chromium WebView you can use the profiling tools via remote debugging

Upvotes: 0

Related Questions