Comments (11)
I did notice that calling setSelection
within onCreate
had no effect even though this works fine using the standardl ListView
. But this works fine in the example app;
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
super.onListItemClick(l, v, position, id);
setSelection(5);
}
If i remove the method onAttachedToWindow
in PullToRefreshListView
the call from onCreate
works as expected. I can't remember why I needed to override onAttachedToWindow
now though. But please test by removing that and if nothing else breaks or anyone else have any problem with removing that method I'm happy to do it.
from android-pulltorefresh.
I ran into the same problem, and after investigation I found out the issue, as explained below by Romain Guy https://groups.google.com/forum/?fromgroups=#!topic/android-developers/EnyldBQDUwE
I created a new method :
private void resetPosition() {
this.post(new Runnable() {
@Override
public void run() {
setSelection(1);
}
}
}
and replaced all references of setSelection(1)
to resetPosition()
and it worked!
from android-pulltorefresh.
Thank you for the report. This is strange, it's using setSelection
internally to hide the header. Will investigate.
from android-pulltorefresh.
Hm worked for me. Could you try it in the test app ?
from android-pulltorefresh.
Great! Using it in the onCreate method was also where I ran into problems. I removed the onAttachToWindow method and now everything works fine. I could see no downsides or other affects from removing the method other then the list starting out with the 'touch to refresh' message being displayed by default. A setSelection(1) in my onCreate solved this.
Many thanks for your quick response!!
from android-pulltorefresh.
Ah that's why we needed it. Well then I don't want to remove it until that problem is solved. If you want to play around with it you can experiment by calling setSelection(1)
from other places internally in the widget.
from android-pulltorefresh.
Hi guys.
I was having the same problem, and I also managed to fix it with your solution!
I simply had to remove the setSelection() call in the onAttachedToWindow() (or actually remove the onAttachedToWindow overriding).
Thanks guys.
Out of curiosity, do you remember why you called setSelection() in that method in the first place?
from android-pulltorefresh.
I have the same problem, anyone here can help me?
from android-pulltorefresh.
I am having the same problem in API 28 Pie. setSelection doesn't work on Pie and scrollTo works first time only but after going to next fragment and coming back to same fragment where I am using ListView, scrollTo doesn't work. So strange behavior on Pie.
from android-pulltorefresh.
Hi, this library is deprecated and there is no active development in it, please have a look at SwipeRefreshLayout for an alternative.
from android-pulltorefresh.
Oh Sorry wrong window
from android-pulltorefresh.
Related Issues (20)
- PullToRefreshListView的GridView,分页时,下一页如果只有一个数据不能马上显示,需要稍微往上拖动下,再往下拖动才可显示出数据,是怎么回事呢? HOT 2
- Tap to refresh always showing HOT 3
- How to set Typeface of text in list HOT 6
- Pull the bottom HOT 1
- Throwing an Exception in this Demo HOT 2
- mLastMotionY not correctly set HOT 2
- expandable list view HOT 1
- Listview on ItemClick gives wrong position HOT 8
- scroll problem HOT 1
- Lag when pulling, (lazy loading image).
- NullPointer when clicking on list items HOT 1
- Works only with linked list HOT 4
- Pull to refresh effect is not working HOT 1
- How to show pull-to-refresh automatically? HOT 3
- Sometimes getting tap to refresh HOT 2
- failed to disable Tap to refresh HOT 1
- Boundary instability issue
- Fast scrolling jump to first visible row
- Possible to add "Load More" button at footer view to loat more data?
- the activity will crashed when I pull to refresh crazily HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from android-pulltorefresh.