Implementation code of Android custom camera interface

We first realize the circular effect of the Photo button. In Android development, of course, we can find artists to design pictures and take them directly, but we can write our own code to achieve this effect. Ha, the most commonly used is to use layout list to realize the superposition of pictures. Our layout is named BTN_ take_ Photo.xml, which is a custom drawable file, so according to the specification, we need to put it in the drawable folder.

Note: the drawable folder is generally used to put custom drawable files. You can regard it as your own background style, etc

Interpretation code:

Three items are placed in the layer list. First, an ellipse with a white background is realized. The attribute Android: shape = "oval" is the shape of Android: shape = ["Rectangle" | "oval" | "line" | "ring"] shape. By default, it is a rectangle. It can be set to rectangle, oval, line and ring, and then put an item, This item is an ellipse with equal length from left to right, up and down OK, so an equilateral ellipse is done

Then put in an ellipse with a blue background again

This is an interface: activity_ take_ The photo.xml interface is very simple. Here is only for reference. The explanation code is: surfaceview is used for taking photos. Note that this class needs to be used as long as it is used for video or taking photos, but it is generally written by itself in projects. These codes only refer to learning from each other. If they have functions, they are still doing them, so first provide these learning... Hoping to help learners, and then write their own blog for the purpose of collecting and sharing their learning technologies, just for the purpose of learning from each other.

Provide custom cameragrid class:

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

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
分享
二维码
< <上一篇
下一篇>>