public class MainActivity extends Activity implements OnItemClickListener,OnScrollListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
// TODO Auto-generated method stub
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem,
int visibleItemCount, int totalItemCount) {
// TODO Auto-generated method stub
}
// 滑动更新数据源之后要重新通知UI simp_adapter.notifyDataSetChanged();
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
// TODO Auto-generated method stub
switch (scrollState) {
case SCROLL_STATE_FLING :
System. out.println("用户在手指离开屏幕之前,由于用力滑了一下,视图依靠惯性滑动" );
break;
case SCROLL_STATE_IDLE :
System. out.println("视图已经停止滑动" );
break;
case SCROLL_STATE_TOUCH_SCROLL :
System. out.println("手指没有离开屏幕,视图正在滑动" );
break;
default:
break;
}
}