Android ScrollView strange scrolling behavior - android

I have an Android app that we've been developing for several years. At some point the scrolling in a WebView has gotten a bit wonky. It has to do with the "momentum" after swiping up or down. Sometimes the momentum will stop prematurely. Sometimes it will appear to bounce and backup a bit. I'm seeing this on multiple devices so I don't think it isa hardware issue.
The problem seems to happen both on external URLs that are loaded and with built-in HTML files (e.g. Help files).
This is a very plain WebView. I've commented out all the code that configures it or manages its WebViewSettings.
It seems it must have something to do with the app it is embedded in, possibly some manifest settings, but I can't imagine what.
Has anyone experienced anything like this?

Try setting the parent View of the Webview to
view.setFocusable(false);
I had a very similar issue involving scrolling a Webview that had a series of DIVs with images. When scrolling down it would spontaneously reverse scroll direction and even sometimes shoot back to the top. It only happened on hardware devices -- never on simulator or in any conventional browser I tested.
See Android reference here: https://developer.android.com/reference/android/view/View.html#setFocusable%28boolean%29

This issue is because of the default scroll behaviour of WebView. If you have a webview inside a ScrollView then, there will be cases where scroll event will be sometimes handled by the scroll view and sometimes by WebView and therefore the jitter during scroll.
In order to fix these scroll issues, please refer this
Scrolling of Webview inside ScrollView

Related

Fullpage.js choppy scrolling on Android 4.2.1

I'm using fullpage.js for an html5/css3/jquery based app for Android 4.2 tablet, that I generate with PhoneGap web service. On PC and emulators everything works smooth and fast, but on tablet itself scrolling between sections is very slow and choppy. Scrolling between slides is a bit better, though not smooth either. I have css3: true in fullpage.js options and I use very light-weight images and elements for the app. Let's say each section loads around 50kb per scroll. I have fixed background for all sections and it stays in place without lags, only loaded per-section content is getting choppy (it looks like it's loading in square patches).
When I open the same html files in tablet's Chrome browser, everything works smooth as well. So I believe it's Android's default WebView causing this choppiness and issues. Is there any way to make it work smooth with fullpage.js?
The link you just posted took 94 seconds to load on my PC using Chrome. And it had plenty of console errors.
Besides that, it is clearly a problem of performance with your site.
You are trying to create a HUGE website layout. With 30 sections and nothing less than 105 slides...
Do not expect it to work smooth on a mobile phone. Your layout in a 1280x1024 resolution is creating a layout of 28.170 pixels height and a few more thousand pixels width. And all of it has to be moved on every scroll.
You can probably make it easier for your browser if you implement some lazy load technique (or even an ajax one for the section/slide contents). This way you will still having the huge layout but it will be empty at least.
Check out this answer for that.
You can even take a look at the lazy load option fullpage.js provides.
Also, using the option scrollBar:true might improve the performance.

How do i include touch swipe? Dynamically load cross platform content and decrease page load times

The idea is to build a website which can grant a mobile and desktop user the full experience. 'The full experience' meaning the use of jquery.
The most important thing is accessibility, so I'm wondering if their is a cross platform way to build a slider/carousel which supports text, links and most importantly touch swipes.
To improve speed, I'd much prefer to load the slides seperately. I understand ajax maybe the solution.. but haven't a clue how. Can anyone direct me towards any basic tutorials that cover this?
A follow up question to the last.. Is ajax safe for dynamically loading content onto mobile devices too?
Also in terms of website layout. Most of the layout will change depending on css media rules when the page is resized. But there are a few elements that will need to teleport depending on the size of the screen.
I considered creating separate elements that would be hidden and shown with jquery/css, but not particularly liking the sound of the code being loaded when it's not needed.
This is slightly different to the sliders in the sense that this code needs to be instantly responsive if the screen size changes (for example, a tablet user changing from portrait to landscape.. or a desktop user zooming in.)
I just don't like the sound of code being loaded if it's hidden.. what is best practice for this?
Again the questions are..
How can i go about building a cross-platform slider, that allows text,links and touch swipe (literally have no idea where to start with touch swipes.)
How can I dynamically load content? (with ajax)? Will this work with smartphones too?
Do people load 'layout' code (on page load) that is only visible if certain parameters are met (eg screen-size.) An example being 2 different menus, one for a small screen and one for a large. Or is there a safe way to load layout code only when it is needed, which would reduce page load times (especially for mobile users.)
thanks
3) touch swipes work the same way as a click + drag, so you should be able to use the same code for mobile and desktop. Here is a great example of this: http://scripterlative.com/files/dragdivscroll.htm

Google Maps slow in Android 2.2's WebView when using CSS3 transformations

I can't get CSS3 transformations and Google Maps to play nice together in Android 2.2's WebView. Here is a fiddle, with two buttons to test transformations. You will need to enable "Emulate touch events" in Chrome to be able to click on them in the desktop. The device I'm using has a 1024x600 screen.
If I don't do anything special, there is flickering when a transformation starts. Now, if I add -webkit-backface-visibility: hidden to the element I'm applying the transformation to, everything is silky smooth and there is no flicker, but the map becomes impossibly slow, and you can't barely scroll around.
I tried to work around this by removing -webkit-backface-visibility by setting it to visible. This works, and the map will be fine again, but setting the property causes flicker. I also played around with -webkit-perspective and -webkit-transform-style, which also seem to get rid of the flicker when a transformation starts, but they also cause flicker when removed.
I also noticed that applying '-webkit-backface-visibility: hidden' to any element on the page makes the flickering at the beginning of transformations disappear. So I put a small div with the property on it, and when the transforms were done, I hid it with "display: none". This causes flicker as well.
My question is, thus: how can I have -webkit-backface-visibility (which I need in order to make the transformations flicker-free) and Google Maps, without making Maps slow?
Possible issues can be 2.2 is rather out of date and you should realistically be using 3.0 now to support tablets. Also, if you are testing on an emulator then this will be your issue.

Android DIV image changed, when clicked on the page

If you open any popup image in the Android browser, then click in any place on the page, the image is being changed (colors/sharpness/whatever - I can't define precisely, since I'm not an artist).
To see this effect, open a site with a popup image, which is implemented as a div with absolute positioning (say, http://highslide.com/ -- the first site I've googled). The site should be open in the Android browser (I've tried Android emulator from Eclipse ADT plugin and Kindle Fire). Click on any preview to popup the image, then tap on the page (keep you finger on the screen) and look at the image the same time.
My question: what this effect is about and how to eliminate it? Why don't I see it neither on PC nor on Mobile Safari? I have the same effect with my web-app, where it looks ugly and seems to be slowing a form, so I want to get rid of it.
A figure:
I've enlarged a portions of two shots, made before tapping on the arrow point, and after, and inserted them on top to show what I'm talking about.
Regards,
There's nothing wrong with your web app or your web page, this is simply a performance feature of Android. You can see this on the homescreen when you scroll and it happens in any application that scrolls.
When you tap, it signals to Android that you might potentially start scrolling. To prepare for this, it uses a compressed version of the images to make scrolling smoother.
You don't see this on your PC because your PC has no problem scrolling through a web page with tons of images at full resolution. As to why you don't see it on mobile safari, I don't know enough about the platform to say.
If every image on the page has the same physical size as specified in HTML/CSS, this effect disappears. That's why I observed this in popups: their inner images usually are resized.
I have mixed feelings. Kinda satisfaction for finding it after all and hatred to Android developers for programming this feature.

Android browser scroll issues

I am making a mobile website running with Jquery Mobile and the site is just like a big form split up in several pages. It works good with all phones except with Android.
The problem is when you focus on a input at the lower part of the page, you wont be able to scroll to see the last element of the page (Which in this case is the submit button) cause the keyboard blocks its display.
I've tried to find any sollution for this - f.o.e i tried to use iScroll without no success.
Is there any good sollutions to this?
Cheers
I had a similar issue on our mobile site. What I ended up doing was hooking the input's focus event and blur events. In the focus event I dynamically increased the height of the page. In the blur event I restored the height. As a safety measure, I also restore the height on the page hide event.
Hope this helps. If needed I can provide more details.

Categories

Resources