Tabnine Logo
SurfaceView.layout
Code IndexAdd Tabnine to your IDE (free)

How to use
layout
method
in
android.view.SurfaceView

Best Java code snippets using android.view.SurfaceView.layout (Showing top 5 results out of 315)

origin: journeyapps/zxing-android-embedded

@SuppressLint("DrawAllocation")
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
  containerSized(new Size(r - l, b - t));
  if(surfaceView != null) {
    if (surfaceRect == null) {
      // Match the container, to reduce the risk of issues. The preview should never be drawn
      // while the surface has this size.
      surfaceView.layout(0, 0, getWidth(), getHeight());
    } else {
      surfaceView.layout(surfaceRect.left, surfaceRect.top, surfaceRect.right, surfaceRect.bottom);
    }
  } else if(textureView != null) {
    textureView.layout(0, 0, getWidth(), getHeight());
  }
}
origin: stackoverflow.com

 public class CroppedCameraPreview extends ViewGroup {
 private SurfaceView cameraPreview;
 public CroppedCameraPreview( Context context ) {
  super( context );
  // i'd probably create and add the SurfaceView here, but it doesn't matter
 }
 @Override
 protected void onMeasure( int widthMeasureSpec, int heightMeasureSpec ) {
  setMeasuredDimension( croppedWidth, croppedHeight );
 }
 @Override
 protected void onLayout( boolean changed, int l, int t, int r, int b ) {
  if ( cameraPreview != null ) {
   cameraPreview.layout( 0, 0, actualPreviewWidth, actualPreviewHeight );
  }
 }
}
origin: stackoverflow.com

 public class CroppedCameraPreview extends ViewGroup {
 private SurfaceView cameraPreview;
 public CroppedCameraPreview( Context context ) {
  super( context );
  // i'd probably create and add the SurfaceView here, but it doesn't matter
 }
 @Override
 protected void onMeasure( int widthMeasureSpec, int heightMeasureSpec ) {
  setMeasuredDimension( croppedWidth, croppedHeight );
 }
 @Override
 protected void onLayout( boolean changed, int l, int t, int r, int b ) {
  if ( cameraPreview != null ) {
   cameraPreview.layout( 0, 0, actualPreviewWidth, actualPreviewHeight );
  }
 }
}
origin: stackoverflow.com

 public class BarcodeCameraPreview extends ViewGroup {

private SurfaceView mSurfaceView;

public BarcodeCameraPreview(final Context context, AttributeSet attrs) {
  super(context, attrs);

  mSurfaceView = new SurfaceView(context);
  mSurfaceView.getHolder().addCallback(new SurfaceCallback());
  addView(mSurfaceView);
}

  @Override
  protected void onLayout(boolean changed, int l, int t, int r, int b) {
    // crop view
    int actualPreviewWidth = getResources().getDisplayMetrics().widthPixels;
    int actualPreviewHeight = getResources().getDisplayMetrics().heightPixels;


    if (mSurfaceView != null) {
      mSurfaceView.layout(0, 0, actualPreviewWidth, actualPreviewHeight);
    }
  }

// camera methods

}
origin: stackoverflow.com

mSurfaceView.layout(0, 0, actualPreviewWidth, actualPreviewHeight);
android.viewSurfaceViewlayout

Popular methods of SurfaceView

  • getHolder
  • <init>
  • onMeasure
  • onInitializeAccessibilityEvent
  • onInitializeAccessibilityNodeInfo
  • setLayoutParams
  • onKeyDown
  • setOnTouchListener
  • onDetachedFromWindow
  • setVisibility
  • getLayoutParams
  • onAttachedToWindow
  • getLayoutParams,
  • onAttachedToWindow,
  • onTouchEvent,
  • onSizeChanged,
  • setOnClickListener,
  • getHeight,
  • getWidth,
  • setKeepScreenOn,
  • onLayout,
  • setZOrderOnTop

Popular in Java

  • Making http requests using okhttp
  • setRequestProperty (URLConnection)
  • setContentView (Activity)
  • scheduleAtFixedRate (Timer)
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now