本文整理了Java中android.view.TextureView.setLayoutParams()
方法的一些代码示例,展示了TextureView.setLayoutParams()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TextureView.setLayoutParams()
方法的具体详情如下:
包路径:android.view.TextureView
类名称:TextureView
方法名:setLayoutParams
暂无
代码示例来源:origin: stackoverflow.com
mTextureView.setLayoutParams(new FrameLayout.LayoutParams(
previewSize.width, previewSize.height, Gravity.CENTER));
代码示例来源:origin: stackoverflow.com
videoView.setLayoutParams(params);
videoSizeSetupDone = true;
代码示例来源:origin: huyongli/TigerVideo
public TextureView createTextureView() {
//重新为播放器关联TextureView
TextureView textureView = newTextureView();
FrameLayout.LayoutParams params =
new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT,
Gravity.CENTER);
textureView.setLayoutParams(params);
return textureView;
}
代码示例来源:origin: Affectiva/affdexme-android
void displayVideo(TextureView videoView) {
textureView = videoView;
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(textureView.getLayoutParams());
// set the video to the same height and width of the actual bitmap inside the imageview
int[] imageAttr = ImageHelper.getBitmapPositionInsideImageView(imageView);
params.width = imageAttr[2]; //width
params.height = imageAttr[3]; //height
textureView.setLayoutParams(params);
videoHolder.addView(textureView);
textureView.setVisibility(VISIBLE);
videoOverlay.setVisibility(VISIBLE);
}
代码示例来源:origin: yangjie10930/OpenGL4Android
/**
* 设置显示比例
*/
private void changeScale(boolean one){
if(one){
stopPreview();
int mTextureViewWidth = mTextureView.getWidth();
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(mTextureViewWidth,mTextureViewWidth);
layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT,RelativeLayout.TRUE);
mTextureView.setLayoutParams(layoutParams);
mCameraRecord.setOutputSize(mOneSize);
mCamera = Camera.open(mUserCamera);
mCameraRecord.startPreview();
}
}
代码示例来源:origin: WangShuo1143368701/VideoView
@SuppressLint("NewApi")
@Override
public void onSurfaceTextureAvailable(SurfaceTexture arg0, int arg1,
int arg2) {
mCamera = Camera.open();
Camera.Size previewSize = mCamera.getParameters().getPreviewSize();
myTexture.setLayoutParams(new FrameLayout.LayoutParams(
previewSize.width, previewSize.height, Gravity.CENTER));
try {
mCamera.setPreviewTexture(arg0);
} catch (IOException t) {
}
mCamera.setPreviewCallback(this);
mCamera.startPreview();
myTexture.setAlpha(1.0f);
myTexture.setRotation(90.0f);
}
@Override
代码示例来源:origin: AriaLyy/BlogDemo
@Override protected void bindData(MyHolder holder, int position, Entity item) {
if (!item.isVideo) {
Glide.with(getContext()).load(item.url).into(((ImgHolder) holder).img);
} else {
mUrl = item.url;
VideoHolder helper = (VideoHolder) holder;
mPb = helper.pb;
if (mPlayer == null) {
mPb.setVisibility(View.VISIBLE);
}
helper.video.setVisibility(View.VISIBLE);
ViewGroup.LayoutParams lp = helper.video.getLayoutParams();
lp.height = 600;
helper.video.setLayoutParams(lp);
helper.video.setSurfaceTextureListener(this);
}
}
代码示例来源:origin: yangjie10930/OpenGL4Android
@Override
public void onGlobalLayout() {
textureView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
//设置控件大小
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) textureView.getLayoutParams();
if (videoFormat.width > videoFormat.height) {
layoutParams.height = textureView.getWidth() * videoFormat.height / videoFormat.width;
} else {
layoutParams.width = textureView.getHeight() * videoFormat.width / videoFormat.height;
}
textureView.setLayoutParams(layoutParams);
//开始解码
mp4Edior.stop();
new Thread(new Runnable() {
@Override
public void run() {
mp4Edior.start();
textureView.setSurfaceTextureListener(AdjustActivity.this);
mp4Edior.setLoop(true);
mp4Edior.decodePrepare(videoPath);
mSize = mp4Edior.getSize();
mTransformation.setScale(mSize, mPreSize, MatrixUtils.TYPE_CENTERINSIDE);
mp4Edior.setTransformation(mTransformation);
mp4Edior.excuate();
}
}).start();
}
});
代码示例来源:origin: fly-studio/douyin-downloader
lp.topMargin = viewRect.y;
lp.bottomMargin = viewRect.y;
textureView.setLayoutParams(lp);
代码示例来源:origin: stackoverflow.com
mCamera = Camera.open();
Camera.Size previewSize = mCamera.getParameters().getPreviewSize();
myTexture.setLayoutParams(new FrameLayout.LayoutParams(
previewSize.width, previewSize.height, Gravity.CENTER));
try {
代码示例来源:origin: klinker24/Android-SimpleVideoView
textureView.setLayoutParams(surfaceViewParams);
addView(textureView, 0);
代码示例来源:origin: stackoverflow.com
case Surface.ROTATION_0:
mCamera.setDisplayOrientation(90);
mTextureView.setLayoutParams(new FrameLayout.LayoutParams(
previewSize.height, previewSize.width, Gravity.CENTER));
transform.setScale(-1, 1, previewSize.height/2, 0);
mTextureView.setLayoutParams(new FrameLayout.LayoutParams(
previewSize.width, previewSize.height, Gravity.CENTER));
transform.setScale(-1, 1, previewSize.width/2, 0);
mTextureView.setLayoutParams(new FrameLayout.LayoutParams(
previewSize.height, previewSize.width, Gravity.CENTER));
transform.setScale(-1, 1, previewSize.height/2, 0);
mTextureView.setLayoutParams(new FrameLayout.LayoutParams(
previewSize.width, previewSize.height, Gravity.CENTER));
transform.setScale(-1, 1, previewSize.width/2, 0);
代码示例来源:origin: Tastenkunst/brfv4_android_examples
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(PREVIEW_WIDTH, PREVIEW_HEIGHT);
layoutParams.gravity = Gravity.LEFT | Gravity.TOP;
mTextureView.setLayoutParams(layoutParams);
mTextureView.setSurfaceTextureListener(this);
addView(mTextureView);
代码示例来源:origin: vbier/habpanelviewer
params.width = 1;
mPreviewView.setLayoutParams(params);
});
代码示例来源:origin: stackoverflow.com
int height) {
mCamera = Camera.open();
mTextureView.setLayoutParams(new FrameLayout.LayoutParams(0, 0,
Gravity.CENTER));
try {
代码示例来源:origin: NodeMedia/NodeMediaClient-Android
public void setRenderType(RenderType renderType) {
if (mCurrentRenderType == renderType)
return;
if (mCurrentRenderType == SURFACEVIEW) {
SurfaceView sv = (SurfaceView) renderView;
sv.getHolder().removeCallback(this);
removeView(renderView);
renderView = null;
} else if (mCurrentRenderType == TEXTUREVIEW) {
TextureView tv = (TextureView) renderView;
tv.setSurfaceTextureListener(null);
removeView(renderView);
renderView = null;
}
if (renderType == SURFACEVIEW) {
SurfaceView sv = new SurfaceView(mContext);
sv.getHolder().addCallback(this);
sv.setLayoutParams(deflp);
renderView = sv;
addView(renderView);
} else if (renderType == TEXTUREVIEW) {
TextureView tv = new TextureView(mContext);
tv.setSurfaceTextureListener(this);
tv.setLayoutParams(deflp);
renderView = tv;
addView(renderView);
}
mCurrentRenderType = renderType;
}
代码示例来源:origin: klinker24/Android-SimpleVideoView
/**
* Adjust the size of the player so it fits on the screen.
*/
private void scalePlayer() {
int videoWidth = mediaPlayer.getVideoWidth();
int videoHeight = mediaPlayer.getVideoHeight();
float videoProportion = (float) videoWidth / (float) videoHeight;
float screenProportion = (float) getWidth() / (float) getHeight();
ViewGroup.LayoutParams lp = textureView.getLayoutParams();
if (videoProportion > screenProportion) {
lp.width = getWidth();
lp.height = (int) ((float) getWidth() / videoProportion);
} else {
lp.width = (int) (videoProportion * (float) getHeight());
lp.height = getHeight();
}
textureView.setLayoutParams(lp);
}
代码示例来源:origin: Affectiva/affdexme-android
textureView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
textureView.setSurfaceTextureListener(new TextureView.SurfaceTextureListener() {
@Override
内容来源于网络,如有侵权,请联系作者删除!