0

qrcodeリーダーを作成しましたが、ボタンを追加する必要があります..プログラムでボタンを追加するにはどうすればよいですか? 例:

Button btnVoltar = new Button(this);
    btnVoltar.setText("Voltar");
    btnVoltar.setX(30);
    btnVoltar.setY(30); 

しかし、このボタンをビューに追加する必要があります。

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if(!isCameraAvailable()) {
        // Cancel request if there is no rear-facing camera.
        cancelRequest();
        return;
    }

    // Hide the window title.
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);

    mAutoFocusHandler = new Handler();

    // Create and configure the ImageScanner;
    setupScanner();

    // Create a RelativeLayout container that will hold a SurfaceView,
    // and set it as the content of our activity.

    mPreview = new CameraPreview(this, this, autoFocusCB);
    setContentView(mPreview);
}
4

0 に答える 0