Codota Logo
SurfaceView.getLayoutParams
Code IndexAdd Codota to your IDE (free)

How to use
getLayoutParams
method
in
android.view.SurfaceView

Best Java code snippets using android.view.SurfaceView.getLayoutParams (Showing top 18 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: stackoverflow.com

int screenHeight = getWindowManager().getDefaultDisplay().getHeight();
float screenProportion = (float) screenWidth / (float) screenHeight;
android.view.ViewGroup.LayoutParams lp = surfaceViewFrame.getLayoutParams();
origin: googlesamples/android-MediaRouter

  public void updateSize(int width, int height) {
    int surfaceHeight = getWindow().getDecorView().getHeight();
    int surfaceWidth = getWindow().getDecorView().getWidth();
    ViewGroup.LayoutParams lp = mPresentationSurfaceView.getLayoutParams();
    if (surfaceWidth * height < surfaceHeight * width) {
      lp.width = surfaceWidth;
      lp.height = surfaceWidth * height / width;
    } else {
      lp.width = surfaceHeight * width / height;
      lp.height = surfaceHeight;
    }
    Log.i(TAG, "Presentation video rect is " + lp.width + "x" + lp.height);
    mPresentationSurfaceView.setLayoutParams(lp);
  }
}
origin: Car-eye-team/Car-eye-device

  @Override
  public void onClick(View v) {
    if (display) {
      seekbarView.setVisibility(View.GONE);
      playbarView.setVisibility(View.GONE);
      display = false;
    } else {
      seekbarView.setVisibility(View.VISIBLE);
      playbarView.setVisibility(View.VISIBLE);
      pView.setVisibility(View.VISIBLE);
      ViewGroup.LayoutParams lp = pView.getLayoutParams();
      lp.height = LayoutParams.FILL_PARENT;
      lp.width = LayoutParams.FILL_PARENT;
      pView.setLayoutParams(lp);
      display = true;
    }
  }
});
origin: huangfangyi/YiChat

private void resizeSurfaceView() {
  Point point;
  if (cameraId == 0) {
    point = backCameraSize.getFirst();
  } else {
    point = frontCameraSize.getFirst();
  }
  if (currentUsePoint != null && point.equals(currentUsePoint)) {
    return;
  } else {
    currentUsePoint = point;
    int screenWidth = getWindowManager().getDefaultDisplay().getWidth();
    int surfaceHeight = screenWidth * point.x / point.y;
    if (surfaceview != null) {
      RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) surfaceview.getLayoutParams();
      lp.width = screenWidth;
      lp.height = surfaceHeight;
      lp.addRule(13);
      surfaceview.setLayoutParams(lp);
    }
  }
}
origin: qiubiteme/android_api_demos

@Override
public void onItemSelected(AdapterView<?> parent, View v, int pos, long id) {
  Resolution r = (Resolution) parent.getItemAtPosition(pos);
  ViewGroup.LayoutParams lp = mSurfaceView.getLayoutParams();
  if (getResources().getConfiguration().orientation
      == Configuration.ORIENTATION_LANDSCAPE) {
    mDisplayHeight = r.y;
    mDisplayWidth = r.x;
  } else {
    mDisplayHeight = r.x;
    mDisplayWidth = r.y;
  }
  lp.height = mDisplayHeight;
  lp.width = mDisplayWidth;
  mSurfaceView.setLayoutParams(lp);
}
origin: li2/learning-android-open-source

@Override
public void onItemSelected(AdapterView<?> parent, View v, int pos, long id) {
  Resolution r = (Resolution) parent.getItemAtPosition(pos);
  ViewGroup.LayoutParams lp = mSurfaceView.getLayoutParams();
  if (getResources().getConfiguration().orientation
      == Configuration.ORIENTATION_LANDSCAPE) {
    mDisplayHeight = r.y;
    mDisplayWidth = r.x;
  } else {
    mDisplayHeight = r.x;
    mDisplayWidth = r.y;
  }
  lp.height = mDisplayHeight;
  lp.width = mDisplayWidth;
  mSurfaceView.setLayoutParams(lp);
}
origin: small-dream/VideoRecord

/**
 * 初始化画布
 */
private void initSurfaceView() {
  final int w = DeviceUtils.getScreenWidth(this);
  ((RelativeLayout.LayoutParams) mBottomLayout.getLayoutParams()).topMargin = w;
  int width = w;
  int height = w * 4 / 3;
  //
  RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) mSurfaceView
      .getLayoutParams();
  lp.width = width;
  lp.height = height;
  mSurfaceView.setLayoutParams(lp);
}
origin: qiniu/qplayer-sdk

private void UpdateSurfaceViewPos(int nW, int nH) {
  if (nW == 0 || nH == 0)
    return;
  RelativeLayout.LayoutParams lpView = (RelativeLayout.LayoutParams) m_svVideo.getLayoutParams();
  RelativeLayout.LayoutParams lpLayout = (RelativeLayout.LayoutParams) m_layVideo.getLayoutParams();
  if (m_nViewWidth == 0 || m_nViewHeight == 0) {
    DisplayMetrics dm = this.getResources().getDisplayMetrics();
    m_nViewWidth = lpLayout.width;
    m_nViewHeight = lpLayout.height;
    if (m_nViewWidth <= 0)
      m_nViewWidth = dm.widthPixels;
    if (m_nViewHeight <= 0)
      m_nViewHeight = dm.heightPixels;
  }
  if (m_nViewWidth * nH > nW * m_nViewHeight) {
    lpView.height = m_nViewHeight;
    lpView.width = nW * m_nViewHeight / nH;
  } else {
    lpView.width = m_nViewWidth;
    lpView.height = nH * m_nViewWidth / nW;
  }
  m_svVideo.setLayoutParams(lpView);
}
origin: ghondar/react-native-vlc-player

holder.setFixedSize(finalWidth, finalHeight);
ViewGroup.LayoutParams lp = mSurface.getLayoutParams();
lp.width = finalWidth;
lp.height = finalHeight;
origin: xugaoxiang/VLCAndroidMultiWindow

LayoutParams lp = mSurface.getLayoutParams();
lp.width = vidW;
lp.height = vidH;
origin: xugaoxiang/VLCAndroidMultiWindow

LayoutParams lp = mSurface.getLayoutParams();
lp.width = vidW;
lp.height = vidH;
origin: stackoverflow.com

int screenHeight = getWindowManager().getDefaultDisplay().getHeight();
float screenProportion = (float) screenWidth / (float) screenHeight;
android.view.ViewGroup.LayoutParams lp = surfaceViewFrame.getLayoutParams();
origin: googlesamples/android-MediaRouter

@Override
protected void updateSize() {
  int width = getVideoWidth();
  int height = getVideoHeight();
  if (width > 0 && height > 0) {
    if (mPresentation == null) {
      int surfaceWidth = mLayout.getWidth();
      int surfaceHeight = mLayout.getHeight();
      // Calculate the new size of mSurfaceView, so that video is centered
      // inside the framelayout with proper letterboxing/pillarboxing
      ViewGroup.LayoutParams lp = mSurfaceView.getLayoutParams();
      if (surfaceWidth * height < surfaceHeight * width) {
        // Black bars on top&bottom, mSurfaceView has full layout width,
        // while height is derived from video's aspect ratio
        lp.width = surfaceWidth;
        lp.height = surfaceWidth * height / width;
      } else {
        // Black bars on left&right, mSurfaceView has full layout height,
        // while width is derived from video's aspect ratio
        lp.width = surfaceHeight * width / height;
        lp.height = surfaceHeight;
      }
      Log.i(TAG, "video rect is " + lp.width + "x" + lp.height);
      mSurfaceView.setLayoutParams(lp);
    } else {
      mPresentation.updateSize(width, height);
    }
  }
}
origin: stackoverflow.com

.getLayoutParams();
origin: lizhangqu/Camera

RelativeLayout.LayoutParams surfaceviewParams = (RelativeLayout.LayoutParams) mSurfaceView.getLayoutParams();
surfaceviewParams.width = heightPixels * 4 / 3;
surfaceviewParams.height = heightPixels;
origin: stackoverflow.com

screenHeight = size.y;
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mSurfaceView.getLayoutParams();
origin: amahi/android

ViewGroup.LayoutParams lp = getSurface().getLayoutParams();
if (mVideoWidth * mVideoHeight == 0) {
origin: stackoverflow.com

mCameraContainerWidth = mSurfaceView.getLayoutParams().width;
  mSurfaceView.getLayoutParams().height = newHeight;
android.viewSurfaceViewgetLayoutParams

Popular methods of SurfaceView

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

Popular in Java

  • Creating JSON documents from java classes using gson
  • onCreateOptionsMenu (Activity)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • startActivity (Activity)
  • DecimalFormat (java.text)
    DecimalFormat is a concrete subclass ofNumberFormat that formats decimal numbers. It has a variety o
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • Locale (java.util)
    A Locale object represents a specific geographical, political, or cultural region. An operation that
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • JOptionPane (javax.swing)
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
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