Hide camera preview but still receive preview callbacks

后端 未结 2 2009
轮回少年
轮回少年 2021-01-20 18:09

I want to show filtered camera preview in my application.

I\'m using Camera.setPreviewCallback() for this. I managed to process callback data and show filtered image

相关标签:
2条回答
  • 2021-01-20 18:34

    Create a simple View with a black background color. Position the view at the same position as the camera's SurfaceView. The camera's preview will be effectively hidden.

    0 讨论(0)
  • 2021-01-20 18:41

    A solution is to even though set the Preview Size to be as the actual screen, in the onMeasure of the Preview SurfaceView make it smaller, that works for me:

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
    {  
       this.setMeasuredDimension(2, 2);  
    }
    
    0 讨论(0)
提交回复
热议问题