I want to resize the camera preview dynamically but always fail.
I start my preview by setting the size as follow
<SurfaceView
android:id="@+id/mSurfaceView1"
android:layout_gravity="center_vertical|center_horizontal"
android:visibility="visible"
android:layout_width="480px"
android:layout_height="320px">
</SurfaceView>
and add a button to resize it to 320 * 240.
But this can't work.What steps do I miss?
Should I just start a new activity with different size of the surfaceView?
Thanks a lot
I start my preview by setting the size as follow
<SurfaceView
android:id="@+id/mSurfaceView1"
android:layout_gravity="center_vertical|center_horizontal"
android:visibility="visible"
android:layout_width="480px"
android:layout_height="320px">
</SurfaceView>
and add a button to resize it to 320 * 240.
Code:
resizeButton.setOnClickListener(new Button.OnClickListener()
{
@Override
public void onClick(View v)
{
// TODO Auto-generated method stub
android.widget.FrameLayout.LayoutParams params = new android.widget.FrameLayout.LayoutParams(320, 240);
surfaceView.setLayoutParams(params);
}
});
Should I just start a new activity with different size of the surfaceView?
Thanks a lot