android.view.SurfaceView.requestLayout()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(1.2k)|赞(0)|评价(0)|浏览(208)

本文整理了Java中android.view.SurfaceView.requestLayout()方法的一些代码示例,展示了SurfaceView.requestLayout()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SurfaceView.requestLayout()方法的具体详情如下:
包路径:android.view.SurfaceView
类名称:SurfaceView
方法名:requestLayout

SurfaceView.requestLayout介绍

暂无

代码示例

代码示例来源:origin: Affectiva/android-sdk-samples

@SuppressWarnings("SuspiciousNameCombination")
  @Override
  public void onCameraSizeSelected(int width, int height, Frame.ROTATE rotate) {
    if (rotate == Frame.ROTATE.BY_90_CCW || rotate == Frame.ROTATE.BY_90_CW) {
      previewWidth = height;
      previewHeight = width;
    } else {
      previewHeight = height;
      previewWidth = width;
    }
    cameraPreview.requestLayout();
  }
}

代码示例来源:origin: Affectiva/android-sdk-samples

/**
 * Update the camera width and height variables, then request a resize of the SurfaceView.
 * Notice that CameraHelper notifies us of the physical, pre-rotation width and height of the camera
 * frames, so we need to account for possible rotation in this method.
 */
@Override
public void onFrameSizeSelected(int width, int height, Frame.ROTATE rotation) {
  if (rotation == Frame.ROTATE.BY_90_CW || rotation == Frame.ROTATE.BY_90_CCW) {
    previewHeight = width;
    previewWidth = height;
  } else {
    previewWidth = width;
    previewHeight = height;
  }
  surfaceView.requestLayout();
}

相关文章