Android java zxing二维码阅读器不可在片段中自定义

Android java zxing二维码阅读器不可在片段中自定义,java,android,android-fragments,Java,Android,Android Fragments,我想在片段中使用二维码阅读器。当我调用intentIntegrator时,inititateScan()是定制的,即将到来,但没有给出响应。否则,当我调用IntentIntegrator.forSupportFragment(Fragment2.this.initiateScan()时阅读器即将推出,但没有我的自定义设置和横向模式 intentIntegrator.setPrompt("Scan a qr code"); intentIntegrator.set

我想在片段中使用二维码阅读器。当我调用intentIntegrator时,inititateScan()是定制的,即将到来,但没有给出响应。否则,当我调用IntentIntegrator.forSupportFragment(Fragment2.this.initiateScan()时阅读器即将推出,但没有我的自定义设置和横向模式

   intentIntegrator.setPrompt("Scan a qr code");
    intentIntegrator.setCameraId(0);  // Use a specific camera of the device
    intentIntegrator.setOrientationLocked(true);
    intentIntegrator.setBeepEnabled(true);
    intentIntegrator.setCaptureActivity(Capture.class);
当我使用第二个选项时,这个自定义项并没有为读卡器设置。我能做什么?我在stackoverflow中搜索了主题,但我的问题没有解决

在清单xml中:

 <activity
        android:name=".Capture"
        android:screenOrientation="fullSensor"
        android:stateNotNeeded="true"
        android:theme="@style/zxing_CaptureTheme"
        android:windowSoftInputMode="stateAlwaysHidden" />
public void scanCode() {
    IntentIntegrator intentIntegrator = new IntentIntegrator(getActivity());
    intentIntegrator.setDesiredBarcodeFormats(IntentIntegrator.ALL_CODE_TYPES);
    intentIntegrator.setPrompt("Scan a qr code");
    intentIntegrator.setCameraId(0);  // Use a specific camera of the device
    intentIntegrator.setOrientationLocked(true);
    intentIntegrator.setBeepEnabled(true);
    intentIntegrator.setCaptureActivity(Capture.class);
   // intentIntegrator.initiateScan();
    IntentIntegrator.forSupportFragment(Fragment2.this).initiateScan();
}

@Override
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {

    IntentResult intentResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);

    if (intentResult != null) {
        if (intentResult.getContents() != null) {
            if (intentResult.getContents().contains(":")) {
                showAlert("Connection String Found", intentResult.getContents());
                profileAddressText.setText(intentResult.getContents().split(":")[0]);
            } else {
                showAlert("Connection String Error", "connection string not acceptible");
            }
        } else {
            showAlert("Not found", "please fill all fields");
        }
    }

}