android - How can I reliably detect a View has moved on the screen? -


i'd keep track of visual position of view, avoiding many callbacks possible. ideally, want this:

view.addonviewmovedlistener(new onviewmovedlistener(){    @override   public void onviewmoved(view v) {     mycode.noticeviewmoved(v);   }  }); 

i can't extend view, needs work view @ all.

the best approach have far adding onpredrawlistener viewtreeobserver. that's way can callback on changes made view.setx() , view.sety(), happens if there's invalidation anywhere in view hierarchy, suboptimal.

what other options there?


Comments