About the ListView after setting the onscrolllistener onscrollstatechanged() and onscroll method does not listen to the problem:
Reason:
The first Onscrolllistener is the focus scrolling listener event, which needs to have focus in order to respond. If the listview is embedded in the ScrollView , the height of the ListView is calculated dynamically and the height is set. Then the user drag the interface, causing the scroll is ScrollView scrolling, rather than the scroll of the ListView , when the focus is ScrollView taken away,thelistview Naturally does not respond to the Onscrolllistener monitoring, the same on the simulator using the mouse wheel slide the ListView The resulting non-responsive Onscrolllistener is also true.
Assumptions and Workarounds:
If the ListView is at the bottom of the ScrollView at this point, and there are some data controls above the ListView that need to be displayed, What if the ListView needs to dynamically set the height and need to complete the paging load function?
Don't be nervous, there are ways to do it, then look down:
1. I started with listening scrollview swipe to the bottom to load more ways, But this leads to a problem when scrollview inline Span style= "Font-family:consolas" >listview time, listview notifydatasetchanged () method because of the need to get interface resources, Scrollview notifydatasetchanged () method, the focus of the capture led to the main line incurring, then this situation is not.
2. Then I want to try to customize scrollview embed Span style= "Font-family:consolas" >listview when automatically focus on listview But this is another problem, scrollview so pass!
Finally I use the killer, listview + headview + footerview Span style= "font-family: Arial", that is, divided into three pieces, custom headview content, custom footerview The display content, is simple and general, fully meet my needs, but there is a need to note that this turntable ( listview there are headview lsitview set Onitemclicklistener, then one method of Onitemclicklistener:
Public void Onitemclick (adapterview<?> arg0, View arg1, int arg2,long arg3) {
}
At this point the click Position should be arg3, not arg2, because the ListView Headview will occupy an item.