0

I have problem statement where I have to detect changes in Android View's location.

eg. I should get notified when view's location is changed by following API call

View.setX() or View.setY()

I can extend the View and override above two methods but if View is inside some parent view and if someone calls ParentView.setX() or ParentView.setY(), it will still update child view location.

I also tried onDraw method, it gets called only once. Is there any method available which get notified every time View's location state is updated.

Pradeep
  • 6,303
  • 9
  • 36
  • 60
  • Use OnLayoutChangeListener. check this link http://stackoverflow.com/questions/19248628/android-listener-for-catching-changes-in-a-views-properties-e-g-androidlay –  Mar 11 '16 at 23:24
  • Nope, it's not being called, I already have global layout listener on view tree – Pradeep Mar 12 '16 at 00:50
  • call requestlayout() when changing your params –  Mar 12 '16 at 01:25
  • I don't have control over View's what's being called, my code sits as part of third party library – Pradeep Mar 12 '16 at 01:41

1 Answers1

-1

viewgroup location is determined by his parents,we can change his width and height by viewgroup layoutparams,or implements its onLayout method to change his location.