Home » Android » How to achieve full screen camera, as well as chan...

How to achieve full screen camera, as well as changes in the impact?

camera time, not full screen, up and down, or around, there are black side.

The reason for this phenomenon:

The preview size is determined by the preview size set, and the preview size at camera must be the same as the video size, otherwise the preview or recorded video will have a stretch of.

When recording the 16:9 of video, the preview area is 16:9; when recording the 4:3 of video, the area shown is 4:3.

When the screen resolution (if there is a virtual key to remove the space occupied by the virtual key) and video size is not an example of the same year, there will be black side.

Since videosize is not recommended to change, because 480P/720P/1080P corresponds to the video size, there is a standard.

If you want to achieve full screen when shooting, there is only one way, that is, the region will be displayed to enlarge the full screen to achieve, but after amplification, the display area will exceed the screen,

So there will be non income phenomenon, the video recorded with the preview when you see the visual angle is different,.

If you can receive the above effects, you can achieve full screen camera.
according to the following method


1. PreviewFrameLayout.java (alpspackagesappscamerasrccomandroidcameraui)
1) add variables
Private Boolean isVideoMode=false;
2) add method
Public, void, setCurrentMode (Boolean, videoMode) {
Log.d (TAG, setCurrentMode, isVideoMode= + videoMode);
IsVideoMode=videoMode;
}
3) modify the public void setAspectRatio (double ratio) method
If (mAspectRatio = = ratio) {
MAspectRatio = ratio;
RequestLayout ();
}
Modify to:
If (isVideoMode)
{
MAspectRatio = ratio;
RequestLayout ();
}
Else
{
If (mAspectRatio = = ratio) {
MAspectRatio = ratio;
RequestLayout ();
}
}
4) protected, void, onMeasure (int, widthSpec, int, heightSpec) methods
If (longSide > shortSide * mAspectRatio) {
LongSide = Math.round ((float) (shortSide * mAspectRatio) / 2) * 2;
} else {
ShortSide = Math.round ((float) (longSide / mAspectRatio) / 2) * 2;
}
Modify to:
If (isVideoMode)
{
If (longSide > shortSide * mAspectRatio) {
ShortSide = Math.round ((float) (longSide / mAspectRatio) / 2) * 2;
} else {
LongSide = Math.round ((float) (shortSide * mAspectRatio) / 2) * 2;
}
}
Else{
If (longSide > shortSide * mAspectRatio) {
LongSide = Math.round ((float) (shortSide * mAspectRatio) / 2) * 2;
} else {
ShortSide = Math.round ((float) (longSide / mAspectRatio) / 2) * 2;
}
}
2. Camera.java (alpspackagesappscamerasrccomandroidcamera)
In the private void setPreviewFrameLayoutAspectRatio () method:
MPreviewFrameLayout.setAspectRatio ((double) width / height);
Before adding:
MPreviewFrameLayout.setCurrentMode (isVideoMode ());
3. PositionController.java (alpspackagesappsgallery2srccomandroidgallery3dui)
Adding method:
Public, Boolean, isFullScreenCenter () {
Box B = mBoxes.get (0);
Return (mPlatform.mCurrentX < = mPlatform.mCurrentX > = 50 & & & & -50) (b.mCurrentY < = 63 & & b.mCurrentY > = -63);
}
4. PhotoView.java (alpspackagesappsgallery2srccomandroidgallery3dui)
Protected void render (GLCanvas canvas) method:
Boolean center = mPositionController.isCenter ();
Modify to:
Boolean center = mPositionController.isFullScreenCenter ();






copyright notice: This article is original article for blogger. Without permission from blogger,.

must not be reprinted

Latest