正如标题已经说过的那样,我有一个基于arrayadapter的列表,并且希望在滚动列表时得到通知(并且只有这样,而不是在绘制列表时)。
这怎么可能?
编辑:我的列表如下所示:
public class MyCustomAdapter extends ArrayAdapter<String>
{
public MyCustomAdapter(Context context, int textViewResourceId, ArrayList<String> processlist)
{
.
.
}
@Override
public View getView(final int position, View convertView, ViewGroup parent)
{
.
.
.
}
}
PS:Java / Android 2.3.4
答案 0 :(得分:1)
要实现所需,您可以将列表上的滚动侦听器设置为:
setOnScrollListener(new OnScrollListener(){
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
// TODO Auto-generated method stub
// Some code that need to be applied simultaneous with scroll event
}
public void onScrollStateChanged(AbsListView view, int scrollState) {
// TODO Auto-generated method stub
if(scrollState == 0)
// Scroll state 0 denotes scrolling is stopped.
}
});
}
答案 1 :(得分:0)
您可以使用setOnScrollListener()