Solution to black screen in Android custom camera

This article describes the solution to the black screen of Android custom camera. Share with you for your reference, as follows:

For some mobile phones, such as HTC, when customizing camera, call camera Parameters of parameters When using the setpreviewsize (width, height) method, if the width and height are odd, a black screen will appear. For solutions, refer to the example of camera in apidemos provided by the SDK:

At the same time, in the HTC phone, set parameters The setpicturesize (width, height) attribute will also cause a black screen, but there is no problem on Samsung phones. In addition, if the width and height of setpreviewsize property are set incorrectly, there will also be bugs such as distortion in the photos taken. Therefore, in case of adaptation problems, the best way is not to set previewsize and picturesize properties.

Getoptimalpreviewsize method

More readers interested in Android related content can view the special topics of this site: summary of Android photography and image processing skills, introduction and advanced tutorial of Android development, summary of Android multimedia operation skills (audio, video, recording, etc.), summary of Android basic component usage, summary of Android view skills, summary of Android layout skills And Android control usage summary

I hope this article will help you in Android programming.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>