this may help you...
RelativeLayout preview = (RelativeLayout) findViewById(R.id.camerapreview);
int width = getResources().getDisplayMetrics().widthPixels;
ViewGroup.LayoutParams params = preview.getLayoutParams();
params.width = width;
params.height = width;
preview.setLayoutParams(params);
here preview
will occupy entire screen width... and it will be square shaped...