In Android, can you create a Listener for catching changes in a View's properties (width / height / margin / position relative to top of the screen)?
I want to trigger an event when layout_marginTop="10dp" is changed to a different value.
What about implementing a OnLayoutChangeListener that gets called when a View is moved due to Layout Change
new View().addOnLayoutChangeListener(new OnLayoutChangeListener() {
@Override
public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft,
int oldTop, int oldRight, int oldBottom) {
// TODO Auto-generated method stub
}
});
Excerpt from Android API:
Add a listener that will be called when the bounds of the view change due to layout processing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With