Codota Logo
SurfaceView.layout
Code IndexAdd Codota 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)

  • Common ways to obtain SurfaceView
private void myMethod () {
SurfaceView s =
  • Codota IconContext context;new SurfaceView(context)
  • Codota IconView view;(SurfaceView) view.findViewById(id)
  • Codota IconViewStub viewStub;(SurfaceView) viewStub.inflate()
  • Smart code suggestions by Codota
}
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

  • Running tasks concurrently on multiple threads
  • setContentView (Activity)
  • onCreateOptionsMenu (Activity)
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • JComboBox (javax.swing)
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.This exception may include information for locating the er
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now