Я пытаюсь развивать свою собственную камеру, но у меня есть проблема, которую я не могу решить...
То, что я хочу, это что-то очень похожее на фоторамку для инстаграма, и это то, что я получаю:
Когда я должен получить что-то подобное:
и...
когда я должен получить что-то вроде:
Я думаю, что хорошо управляю предварительным просмотром SurfaceView и камеры, только используя
Camera.Parameters parameters = camera.getParameters();
camera.setDisplayOrientation(90);
и Пользовательский SurfaceView:
public class SquaredSurfaceView extends SurfaceView {
private int width;
private int height;
public SquaredSurfaceView(Context context) {
super(context);
}
public SquaredSurfaceView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public SquaredSurfaceView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
width = MeasureSpec.getSize(widthMeasureSpec);
height = width;
setMeasuredDimension(width, width);
}
public int getViewWidth() {
return width;
}
public int getViewHeight() {
return height;
}
}
Что я делаю не так??:-(