package com.ldci.listview;
import android.app.ListActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.AbsListView;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.AbsListView.OnScrollListener;
public class MainAct extends ListActivity {
private String[] title = {"aaa","bbb","ccc","ddd","eee","fff","ggg","hhh","iii","jjj","kkk","lll",
"mmm","nnn","ooo","ppp","qqq","rrr","sss","ttt"};
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
MyAdapter adapter = new MyAdapter(this, title);
setListAdapter(adapter);
ListView listView = new ListView(this);
listView.setOnScrollListener(new OnScrollListener() {
ImageView imageView = (ImageView)findViewById(R.id.imageView1);
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
// TODO Auto-generated method stub
if(scrollState==SCROLL_STATE_FLING){
imageView.setVisibility(View.VISIBLE);
}else{
imageView.setVisibility(View.INVISIBLE);
}
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem,
int visibleItemCount, int totalItemCount) {
// TODO Auto-generated method stub
}
});
}
}