Android 离子4https://ionicframework.com/docs/native/camera-preview 托巴克:真的不管用 我的工作离子4角型应用 我想定制相机应用程序 所以我使用的是摄像头预览cordova插件
在我的作文中Android 离子4https://ionicframework.com/docs/native/camera-preview 托巴克:真的不管用 我的工作离子4角型应用 我想定制相机应用程序 所以我使用的是摄像头预览cordova插件,android,angular,cordova-plugins,ionic4,Android,Angular,Cordova Plugins,Ionic4,在我的作文中 import { CameraPreview, CameraPreviewOptions,CameraPreviewPictureOptions } from '@ionic-native/camera-preview/ngx'; private cameraPreview: CameraPreview taskphoto(){ this.imgurl = '' this.cameraPreview.startCamera(this.cameraOpts).then
import { CameraPreview, CameraPreviewOptions,CameraPreviewPictureOptions } from '@ionic-native/camera-preview/ngx';
private cameraPreview: CameraPreview
taskphoto(){
this.imgurl = ''
this.cameraPreview.startCamera(this.cameraOpts).then(res=>{
// this.cameraPreview.
console.log(res);
this.imgurl = 'data:image/jpeg;base64,' + res;
}, (err) => {
console.log(err);
this.imgurl =''
//this.imgurl = 'assets/img/test.jpg';
alert(err)
});
}
在HTML中
<ion-fab class="fbtn" vertical="bottom" (click)="takePicture()" horizontal="center" slot="fixed">
<ion-fab-button>
<ion-icon name="camera"></ion-icon>
</ion-fab-button>
</ion-fab>
<ion-fab class="fbtn" vertical="bottom" (click)="stop()" horizontal="start" slot="fixed">
<ion-fab-button>
<ion-icon name="arrow-back"></ion-icon>
</ion-fab-button>
</ion-fab>
<ion-fab class="fbtn" vertical="bottom" (click)="switchCamera()" horizontal="end" slot="fixed">
<ion-fab-button>
<ion-icon name="repeat"></ion-icon>
</ion-fab-button>
</ion-fab>
背景色:透明;
}
以及我添加的组件SCS
ion-content {--background-color: transparent !important}
body.camera-transparent, .camera-transparent ion-nav-view, .camera-transparent ion-view { background-color: transparent !important; }
这行代码仍然不起作用html、正文、.ion应用程序、.ion内容{背景色:透明;}我试过了,但没有出现,在确切的文件中,或者任何项目示例中是否存在??检查此链接。。。。
ion-content {--background-color: transparent !important}
body.camera-transparent, .camera-transparent ion-nav-view, .camera-transparent ion-view { background-color: transparent !important; }