Full screen preview camera2Basic Example Project

后端 未结 1 1278
忘了有多久
忘了有多久 2020-12-22 04:08

I\'m trying to modify Google\'s camera2Basic example code. I removed the containing the \"Picture\" and \"Info\" button in an attempt to ma

相关标签:
1条回答
  • 2020-12-22 04:44

    I noticed this exact same issue before on my Galaxy Note 5 and I believe it had to do with the way they set the aspect ratio - there are apparently some limitations with this API (or just poorly documented). I fixed it by not setting the aspect ratio on the AutoFitTextureView.

    Specifically in this example, in the method setCameraOutput(int width, int height), simply remove these lines of code (lines 574 - 580 in your example):

    if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
        mTextureView.setAspectRatio(mPreviewSize.getWidth(),mPreviewSize.getHeight());
    } else {
        mTextureView.setAspectRatio(mPreviewSize.getHeight(),mPreviewSize.getWidth());
    }
    

    I believe that in the example they are trying to limit the capture area which likely leads to the black bar you are seeing (probably because you are building on a larger device than the one the person who developed used).

    0 讨论(0)
提交回复
热议问题