把AndroidManifest 文件中 TuFragmentActivity 的声明修改为:
    <!-- *******************公共分组控制器******************* -->
    <activity
        android:name="org.lasque.tusdk.impl.activity.TuFragmentActivity"
        android:configChanges="keyboardHidden|orientation|screenSize"
        android:screenOrientation="landscape"
        android:windowSoftInputMode="stateHidden|adjustResize" >
    </activity>
新建子类TuCameraNewFragment继承 TuCameraFragment ,在子类中重写下面的方法:
protected void initCameraView() 
{
    super.initCameraView();
    ((TuSdkStillCamera)getCamera()).setOutputImageOrientation(InterfaceOrientation.PortraitUpsideDown);
};
设置自定义TuCameraFragment
  TuCameraOption option = new TuCameraOption();
  option.setComponentClazz(TuCameraNewFragment.class);
另外需要添加如下设置才能保证输出的图片朝向正常: 首先设置相机保存到相册和保存到临时文件都设置为false,如下:
// 保存到临时文件 (默认不保存, 当设置为true时, TuSdkResult.imageFile, 处理完成后将自动清理原始图片)
option.setSaveToTemp(false);
// 保存到系统相册 (默认不保存, 当设置为true时, TuSdkResult.sqlInfo, 处理完成后将自动清理原始图片)
option.setSaveToAlbum(false);
拍完照之后,在方法onTuCameraFragmentCaptured(TuCameraFragment fragment, TuSdkResult result)中,使用如下方式将获取到的图片旋转:
@Override
public void onTuCameraFragmentCaptured(TuCameraFragment fragment, TuSdkResult result)
{
    fragment.hubDismissRightNow();
    fragment.dismissActivityWithAnim();
    Bitmap aBitmap = BitmapHelper.imageRotaing(result.image, ImageOrientation.Down);
    BitmapHelper.saveBitmap(new File("/storage/emulated/0/DCIM/Camera/boannaao.png"), aBitmap, 90);
    TLog.d("onTuCameraFragmentCaptured: %s", result);
}
            
                ©2019-2025 TUTUCLOUD. All Rights Reserved. 杭州元凡视觉智能科技有限公司 | 浙ICP备14040447号-1 | 
浙公网安备33010602001649号