android.view.TextureView#setLayoutParams ( )源码实例Demo

下面列出了android.view.TextureView#setLayoutParams ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: FimiX8-RE   文件: FimiH264Video.java
public void init() {
    this.mVideoWidth = 0;
    this.mVideoHeight = 0;
    setBackgroundColor(ViewCompat.MEASURED_STATE_MASK);
    setFocusable(true);
    setFocusableInTouchMode(true);
    requestFocus();
    this.mCurrentState = 0;
    this.mTargetState = 0;
    TextureView renderUIView = new TextureView(getContext());
    renderUIView.setLayoutParams(new LayoutParams(-2, -2, 17));
    renderUIView.setSurfaceTextureListener(this.mSurfaceCallback);
    this.mX8Camera9GridView = new X8Camera9GridView(getContext());
    this.mX8Camera9GridView.setLayoutParams(new LayoutParams(-1, -1, 17));
    this.mX8AiTrackContainterView = new X8AiTrackContainterView(getContext());
    this.mX8AiTrackContainterView.setLayoutParams(new LayoutParams(-1, -1, 17));
    this.blackView = new View(getContext());
    this.blackView.setLayoutParams(new LayoutParams(-1, -1, 17));
    this.blackView.setBackgroundColor(getContext().getResources().getColor(R.color.black));
    addView(renderUIView);
    addView(this.mX8AiTrackContainterView);
    addView(this.blackView);
    addView(this.mX8Camera9GridView);
    showGridLine(GlobalConfig.getInstance().getGridLine());
}
 
源代码2 项目: iGap-Android   文件: FragmentShowImage.java
/**
 * get real width and height video
 */
private void getRealSize(MediaPlayer mp, TextureView mTextureView) {

    if (mp == null || mTextureView == null) {
        return;
    }

    //Get the dimensions of the video
    int videoWidth = mp.getVideoWidth();
    int videoHeight = mp.getVideoHeight();

    Display display = G.fragmentActivity.getWindowManager().getDefaultDisplay();

    int finalWith, finalHeight;

    finalWith = display.getWidth();
    finalHeight = (int) (((float) videoHeight / (float) videoWidth) * (float) display.getWidth());

    if (finalHeight > display.getHeight()) {
        finalWith = (int) (((float) finalWith / (float) finalHeight) * (float) display.getHeight());
        finalHeight = display.getHeight();
    }

    ViewGroup.LayoutParams lp = mTextureView.getLayoutParams();
    lp.width = finalWith;
    lp.height = finalHeight;
    mTextureView.setLayoutParams(lp);
}
 
源代码3 项目: TigerVideo   文件: StandardVideoView.java
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;
    }
 
源代码4 项目: CameraCompat   文件: DirectChain.java
@Override
public View createSurface(Context context) {
    mTextureView = new TextureView(context);
    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    mTextureView.setLayoutParams(params);
    mTextureView.setKeepScreenOn(true);
    return mTextureView;
}
 
源代码5 项目: backgroundvideo   文件: VideoOverlay.java
public VideoOverlay(Context context) {
    super(context);

    this.setClickable(false);
    this.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));

    // Create surface to display the camera preview
    mPreview = new TextureView(context);
    mPreview.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    mPreview.setClickable(false);
    mPreview.setSurfaceTextureListener(this);
    attachView();
}