Android ListView add items to top without list view scroll [duplicate]

I have found solution here Retaining position in ListView after calling notifyDataSetChanged Sorry for duplicate question. The final code is this: int index = this.commentsListView.getFirstVisiblePosition() + comments.size(); View v = this.commentsListView.getChildAt(commentsListView.getHeaderViewsCount()); int top = (v == null) ? 0 : v.getTop(); this.commentsListViewAdapter.AddRangeToTop(comments); this.commentsListViewAdapter.notifyDataSetChanged(); this.commentsListView.setSelectionFromTop(index, top);

Load ajax when scroll reaches 80%

Provided your current check is firing when scrolled to the page’s bottom, you can try some basic arithmetics: if ($(window).scrollTop() >= ($(document).height() – $(window).height())*0.7){ //where 0.7 corresponds to 70% –^ Make sure to add a check to don’t fire multiple simultaneous Ajax requests, if you didn’t already. This is rather out of the scope of … Read more

Can’t prevent `touchmove` from scrolling window on iOS

I recently ran into this same problem. You’ll need to pass { passive: false } when registering the touchmove event listener. e.g. document.addEventListener(‘touchmove’, function(e) { e.preventDefault(); }, { passive: false }); This is because document touch event listeners are now passive by default in Safari 11.1, which is bundled with iOS 11.3. This change is … Read more

Android: Detecting When ScrollView Hits Bottom [duplicate]

Try this: @Override protected void onScrollChanged(int l, int t, int oldl, int oldt) { // Grab the last child placed in the ScrollView, we need it to determinate the bottom position. View view = (View) getChildAt(getChildCount()-1); // Calculate the scrolldiff int diff = (view.getBottom()-(getHeight()+getScrollY())); // if diff is zero, then the bottom has been reached … Read more

CSS 100% Height, and then Scroll DIV not page

<html> <body style=”overflow:hidden;”> <div style=”overflow:auto; position:absolute; top: 0; left:0; right:0; bottom:0″> </div> </body> </html> That should do it for a simple case I believe this will work for your case <html> <body style=”overflow:hidden;”> <div id=”header” style=”overflow:hidden; position:absolute; top:0; left:0; height:50px;”></div> <div id=”leftNav” style=”overflow:auto; position:absolute; top:50px; left:0; right:200px; bottom:50px;”></div> <div id=”mainContent” style=”overflow:auto; position:absolute; top:50px; left: 200px; … Read more