I'm trying to develop my own camera activity, but I have a problem that I'm not unable to solve...
What I want, is something very similiar to instagram photo frame, and this is what I get:
When I should get something like this:
and...
when I should get something like:
I think I'm maanaging the SurfaceView and Camera preview well, only using
Camera.Parameters parameters = camera.getParameters();
camera.setDisplayOrientation(90);
and Custom 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;
}
}
What I'm doing wrong?? :-(
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…