listview resets/jumps to top when scrolling fast - android

I have a listview in a fragment that on a fast scroll, it jumps back to the top of the list. Sometimes it happens if you scroll really slowly too.
It seems to only happen on Galaxy Nexus and Galaxy S3, both of which are on 4.3. All other test devices we have are on 4.4 and they work fine.
I am seeing absolutely nothing in the logs when this happens, and am completely lost as to why this might happen.
I would post code, but there is a hell of a lot involved including animations on new items appearing and stuff. However, I've removed a lot of the code for animations and what not, with comments and I still get the list jumping back to the top.
Anyone experience this?

I might have stumbled upon a fix for that problem. I had a problem where fastScroll would bug out when some of the elements where set to hidden and it would scroll a bit and then jump back to top.
But after adding FooterView (empty one with paddingBottom: 16dp) to ListView would remove that jumping bug. Hopefully it helps you to fix it.

Related

WebView in ListView drawn twice (Why and how to solve?)

I am using a ListView with a WebView every 30 items for special HTML ads (animated) which are provided from a WebServer. This normally works okay. But sometimes it seems to draw the content of the WebView twice as seen in the screenshot below. The WebView continues animating but the misplaced (left bottom) drawing stays the same. When one interacts with the screen (scrolls) the wrongly drawn space disappears.
Now my questions are:
Why is this happening?
How can I prevent this from happening?
My current guess for Nr. 1 is: Somehow the WebView gets positioned in the left bottom just for a quick time where it as well draws. Then it gets positioned correctly but the ListView does not redraw that area because it thinks all is still at the same position.
Thanks to anyone who can help.
UPDATE:
I used the same WebView with the animation centered in a RelativeLayout. The same problem occurred there. So the problem is not in the ListView.
WebViews don't go well with ListViews, you may have to do a lot of hacks, including handling touch events, etc.
If you list doesn't display an 'infinite' list of items, or at least the list is never too big, you can maybe give a try on this custom listview from this other post: https://stackoverflow.com/a/21878703/684582
it was designed to support a ListView inside a ScrollView, but it might just help you on your problem without much redesign. I hope it helps! Good luck!
I found the problem in the WebView coming from the advertiser. The problem seems to be setting the LayerType to HARDWARE. That caused the Problem. Setting the the LayerType to NONE or SOFTWARE the problem went away. Now I just wonder WHY that caused the problem.
A normal WebView uses LAYER_TYPE_NONE by default.
Solution in short:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}

Bootstrap 3.0.0 fixed menu bar, not working correctly on android phones

I got a problem with Bootstrap's fixed menu bar.
Works fine on Desktop browsers, but on phones (especially on Android phones) the menu bar behaves weird.
The logo is not always present on a page load, and when you wipe over the position where it is supposed to be, it suddenly shows up. Also when changing the orientation to landscape, the toggle/collapse button is lost somewhere in the middle of the nav bar, and doesnt stay on the right side anymore.
It seems like fixed bars on Android are buggy...and the rendering is messed up somehow...
Has anybody seen the same weird behaviour before? Is there a good fix?
Found a dirty workaround, that somehow forces the android browser to rerender the elements mentioned above:
$("#navbar .logo img").width(31).width(32);
$("#navbar .logo img").height(31).width(32);
$("#navbar").hide();
$("#navbar").get(0).offsetHeight;
$("#navbar").show();
Obviously this code is rather silly ;) but it works...since it comes down to small css adjustments which are reversed right away, there might be a smarter solution to force a rerendering. However having the browser measure the offset of at least one of the involved elements seems to be crucial...

Android WebView jumping to the bottom

I have a ScrollView with 20 WebViews inside (yes, I know it's heavy but right now it's the best solution I've found). The WebViews are used to display forum posts.
I'm getting a very weird behavior on my Nexus 4 (it doesn't happen on some other devices I've tested) which is driving me crazy.
I have the first post visible and just a little bit of the second one visible. Now I want to scroll and instead of starting scrolling by putting the finger in the first post I put the finger on the portion of the second post that is visible. The WebView of that second post immediately jumps to the bottom which is a very annoying behavior while scrolling.
If you feel appropriate I can record a video of this behavior and upload to YouTube or you can search for AndroidPIT in the Play Store and check the behavior yourself in the Forum section. I won't post the link to the Play Store to avoid being called a spammer.
Thanks in advance.
From comment: "Have you tried setting your webview to non focusable and non clickable as it appears as it's trying to display the entire content of the item you are pressing on as you scroll"
Apparently View#setFocusable (view.setFocusable(false)) worked.
Make sure that the scrolling is handled by the scrollview in stead of the webview. I believe setting the Webview.canscrollvertically to false might fix the problem, let me know if it helped.

android scroll and swipe difficulty

Good Evening,
i am having a problem with android 4.1 when it comes to scrolling and swiping. (I am using jquery mobile)
I have a list which you can delete items from by simply swiping to the right. When it comes to iOS, everything is really crisp. But it seems that android cant handle scrolling and swiping on the same element. You can only scroll in a 90° angle, but changing it to ~85° messes up the scrolling.
When i remove the swiping event, everything works fine. Is there a known fix for that?
Regards Dominik
$.event.special.swipe.scrollSupressionThreshold is the answer to that problem.
JqueryMobiel supresses scrolling when there is a swipe event on an item. Simply modify the values above to your liking and you'll be fine!
$.event.special.swipe.scrollSupressionThreshold = "30px";
30px is not the right parameter, it is 30 (without px), but 30px solves my problem.

Android: ScrollBar bug in 2.2 for ListView

The problem appears in Android 2.2. It seems cool because it can auto-hide.But I don't like it quite much because the bar is an indicator for "Whether there is more content not present on the widget". Hiding it maybe neat, but may get the users wrong sometimes. In ListView, I find it a fatal bug at all. When there is more content to show, no scrollbar present, AND when wipe the screen down-wards, no scroolbar appears. Only when use the traceball or Dpad to move focus, there appears the scrollbar. BUT THERE IS WORSE: when you wipe down-wards to move the scrollbar down, nothing happens! The touch feature is almost disabled here.
Can anyone help me here? Thanks!
Maybe answers there will help you
Android ListView that does not scroll?
I had a listview inside of a scrollview. After I'd commented scrollview it was possible to use listview's scrolling.
The weird thing is, that this problem occurs only on Android 2.2.
I am using a listView in android 2.2 and it works just fine . The vertical scrolling happens implicitly without the inclusion of a scroll view . Hope your ListView id is #android:id/list.
And a small correction , to move down the list , you need to wipe the screen UPWARDS not DOWNWARDS ....

Categories

Resources