nativescript

implement 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 https://stackoverflow.com/documentation/proposed/changes/79536

Add Listener:

    surfaceView.addOnLayoutChangeListener(playerLayoutChangeListener);

remove Listener:

    surfaceView.removeOnLayoutChangeListener(playerLayoutChangeListener);

This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow