nativescriptimplement Interface

implement View.OnLayoutChangeListener in Nativescript


let playerLayoutChangeListener = new android.view.View.OnLayoutChangeListener( {
      onLayoutChange : function ( v:View, left:number, top:number, right:number, bottom:number, oldLeft:number, oldTop:number, oldRight:number, oldBottom:number):any {
          if (left != oldLeft || top != oldTop || right != oldRight || bottom != oldBottom) {
              console.log("OnLayoutChangeListener");
              __this.changeSurfaceLayout();
          }
      }
    });

create a surfaceView http://stackoverflow.com/documentation/proposed/changes/79536

Add Listener:

    surfaceView.addOnLayoutChangeListener(playerLayoutChangeListener);

remove Listener:

    surfaceView.removeOnLayoutChangeListener(playerLayoutChangeListener);