0

我正在制作自定义相机布局。它有一个框架布局和图像按钮。我想根据相机旋转来旋转这个按钮。所以每当我在图像按钮中旋转相机时,都应该面向正确的方向。但我无法弄清楚如何做到这一点。这是我的代码...

public class CameraActivity extends Activity
{
protected void onCreate(Bundle savedInstanceState) {    
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
                WindowManager.LayoutParams.FLAG_FULLSCREEN);

        // Get an instance of the WindowManager
        mWindowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
        mDisplay = mWindowManager.getDefaultDisplay();

        setContentView(R.layout.camera_layout);


        btnCapture = (ImageButton)findViewById(R.id.btn_capture);       
        mCamera = getCameraInstance();
        mPreview = new CameraPreview(this, mCamera);
        FrameLayout camPreview = (FrameLayout)findViewById(R.id.camera_preview);
        camPreview.addView(mPreview);   
    }
}
4

0 回答 0