我有一个ScrollView包含一定数量的视图,我会在滚动中的最后一个视图变为可见时执行AsyncTask。 我该怎么办?
答案 0 :(得分:0)
我认为这可能有用
ScrollView sv = new ScrollView(this.getActivity());
sv.post(new Runnable() {
@Override
public void run() {
// this is executed when it becomes visible for the first time
}
});
修改强>
如果你想从scrollView中的元素中获取它,如果你使用的是适配器,那么</ p>
// Adapter class ie ArrayAdapter
public View getView(int position, View convertView, ViewGroup parent) {
View myView;
//....
myView.post(new Runnable() {
@Override
public void run() {
// this is executed when it becomes visible for the first time
}
});
return myView;
}